SimpleSAML\Utils\HTTP::getServerPort PHP Method

getServerPort() private static method

Retrieve the port number from $_SERVER environment variables.
Author: Olav Morken, UNINETT AS ([email protected])
private static getServerPort ( ) : string
return string The port number prepended by a colon, if it is different than the default port for the protocol (80 for HTTP, 443 for HTTPS), or an empty string otherwise.
    private static function getServerPort()
    {
        $port = isset($_SERVER['SERVER_PORT']) ? $_SERVER['SERVER_PORT'] : '80';
        if (self::getServerHTTPS()) {
            if ($port !== '443') {
                return ':' . $port;
            }
        } else {
            if ($port !== '80') {
                return ':' . $port;
            }
        }
        return '';
    }