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 ''; }