getHost() public method

Returns the host or an empty string if no host is set.
public getHost ( ) : string
return string
Beispiel #1
0
 /**
  * Sets the host based on the current URI.
  */
 private function setHostFromUri()
 {
     $this->hostFromUri = true;
     $host = $this->uri->getHost();
     if (!empty($host)) {
         // Do not set Host header if URI has no host.
         $port = $this->uri->getPort();
         if (null !== $port) {
             $host = sprintf('%s:%d', $host, $port);
         }
         parent::setHeader('Host', $host);
     }
 }