public static function protocolHostPort()
    {
        if (RequestHelper::isCli()) {
            return null;
        }

        $isHttps = RequestHelper::isHttps();
        $protocol = 'http' . ($isHttps ? 's' : '');
        $serverName = $_SERVER['SERVER_NAME'];
        $serverPort = (int)$_SERVER['SERVER_PORT'];

        $protocolHostPort = $protocol . '://';

        if ((!$isHttps && $serverPort !== 80) || ($isHttps && $serverPort !== 443)) {
            $protocolHostPort .= $serverName . ':' . $serverPort;
        } else {
            $protocolHostPort .= $serverName;
        }

        return $protocolHostPort;
    }
public static function protocolHostPort()
    {
        if (RequestHelper::isCli()) {
            return null;
        }

        $isHttps = RequestHelper::isHttps();
        $protocol = 'http' . ($isHttps ? 's' : '');
        $serverName = $_SERVER['SERVER_NAME'];
        $serverPort = (int)$_SERVER['SERVER_PORT'];

        $protocolHostPort = $protocol . '://';

        if ((!$isHttps && $serverPort !== 80) || ($isHttps && $serverPort !== 443)) {
            $protocolHostPort .= $serverName . ':' . $serverPort;
        } else {
            $protocolHostPort .= $serverName;
        }

        return $protocolHostPort;
    }
public static function protocolHostPort ( ) { if ( RequestHelper :: isCli ( ) ) { return null ; } $ isHttps = RequestHelper :: isHttps ( ) ; $ protocol = 'http' . ( $ isHttps ? 's' : '' ) ; $ serverName = $ _SERVER [ 'SERVER_NAME' ] ; $ serverPort = ( int ) $ _SERVER [ 'SERVER_PORT' ] ; $ protocolHostPort = $ protocol . '://' ; if ( ( ! $ isHttps && $ serverPort !== 80 ) || ( $ isHttps && $ serverPort !== 443 ) ) { $ protocolHostPort .= $ serverName . ':' . $ serverPort ; } else { $ protocolHostPort .= $ serverName ; } return $ protocolHostPort ; }
Returns string of protocol, server name and port of server-side configured values.

e.g.:
http://example.com
http://example.com:8080 (if custom http port is used)
https://example.com:444 (if custom https port is used)

@return null|string
Returns string of protocol server name and port of server - side configured values .