src/Utilities/Uri.php
public static function getServerNameOrIp($withProtocol = false)
    {
        $host = Miscellaneous::getSafelyGlobalVariable(INPUT_SERVER, 'HTTP_HOST');

        /*
         * Unknown host / server?
         * Nothing to do
         */
        if (empty($host)) {
            return '';
        }

        /*
         * With protocol?
         * Let's include the protocol
         */
        if ($withProtocol) {
            return sprintf('%s://%s', self::getProtocolName(), $host);
        }

        return $host;
    }
public static function getServerNameOrIp($withProtocol = false)
    {
        $host = Miscellaneous::getSafelyGlobalVariable(INPUT_SERVER, 'HTTP_HOST');

        /*
         * Unknown host / server?
         * Nothing to do
         */
        if (empty($host)) {
            return '';
        }

        /*
         * With protocol?
         * Let's include the protocol
         */
        if ($withProtocol) {
            return sprintf('%s://%s', self::getProtocolName(), $host);
        }

        return $host;
    }
public static function getServerNameOrIp ( $ withProtocol = false ) { $ host = Miscellaneous :: getSafelyGlobalVariable ( INPUT_SERVER , 'HTTP_HOST' ) ; /*
         * Unknown host / server?
         * Nothing to do
         */ if ( empty ( $ host ) ) { return '' ; } /*
         * With protocol?
         * Let's include the protocol
         */ if ( $ withProtocol ) { return sprintf ( '%s://%s' , self :: getProtocolName ( ) , $ host ) ; } return $ host ; }
Returns server name or IP address

@param bool $withProtocol (optional) If is set to true, protocol name is included. Otherwise isn't.
@return string
Returns server name or IP address