Пример #1
0
 /**
  * Creates a base url string including scheme, host and port in case
  * it differs from the default ports.
  *
  * @param Url $url The current url representation.
  *
  * @return string The formatted base url.
  *
  * @author Christian Achatz
  * @version
  * Version 0.1, 07.04.2011<br />
  */
 protected function getFormattedBaseUrl(Url $url)
 {
     $baseUrl = '';
     $scheme = $url->getScheme();
     if (!empty($scheme)) {
         $baseUrl .= $scheme . '://';
     }
     $host = $url->getHost();
     if (!empty($host)) {
         $baseUrl .= $host;
     }
     $port = $url->getPort();
     if (!empty($port) && $port !== Url::DEFAULT_HTTP_PORT && $port !== Url::DEFAULT_HTTPS_PORT) {
         $baseUrl .= ':' . $port;
     }
     return $baseUrl;
 }