src/AbstractUrl.php
protected static function fetchServerHost(array $server)
    {
        if (isset($server['HTTP_HOST'])) {
            $header = $server['HTTP_HOST'];
            if (! preg_match('/(:\d+)$/', $header, $matches)) {
                return $header;
            }

            return substr($header, 0, -strlen($matches[1]));
        }

        if (isset($server['SERVER_ADDR'])) {
            return $server['SERVER_ADDR'];
        }

        throw new RuntimeException('Host could not be detected');
    }
protected static function fetchServerHost(array $server)
    {
        if (isset($server['HTTP_HOST'])) {
            $header = $server['HTTP_HOST'];
            if (! preg_match('/(:\d+)$/', $header, $matches)) {
                return $header;
            }

            return substr($header, 0, -strlen($matches[1]));
        }

        if (isset($server['SERVER_ADDR'])) {
            return $server['SERVER_ADDR'];
        }

        throw new RuntimeException('Host could not be detected');
    }
protected static function fetchServerHost ( array $ server ) { if ( isset ( $ server [ 'HTTP_HOST' ] ) ) { $ header = $ server [ 'HTTP_HOST' ] ; if ( ! preg_match ( '/(:\d+)$/' , $ header , $ matches ) ) { return $ header ; } return substr ( $ header , 0 , - strlen ( $ matches [ 1 ] ) ) ; } if ( isset ( $ server [ 'SERVER_ADDR' ] ) ) { return $ server [ 'SERVER_ADDR' ] ; } throw new RuntimeException ( 'Host could not be detected' ) ; }
Return the Server URL host component

@param array $server the server array

@return string

@throws \RuntimeException If no host is detected
Return the Server URL host component