private function checkAndReturnType($type) { if (empty($type)) { $type = Site::DEFAULT_SITE_TYPE; } if (!is_string($type)) { throw new Exception("Invalid website type {$type}"); } return $type; }