public static getSelfURLhost ( ) : string | ||
return | string | $url |
public static function getSelfURLhost()
{
$currenthost = self::getSelfHost();
$port = '';
if (self::isHTTPS()) {
$protocol = 'https';
} else {
$protocol = 'http';
}
$portnumber = self::getSelfPort();
if (isset($portnumber) && $portnumber != '80' && $portnumber != '443') {
$port = ':' . $portnumber;
}
return $protocol . "://" . $currenthost . $port;
}
/** * Tests the getSelfRoutedURLNoQuery method of the OneLogin_Saml2_Utils * * @covers OneLogin_Saml2_Utils::getSelfRoutedURLNoQuery */ public function getSelfRoutedURLNoQuery() { $url = OneLogin_Saml2_Utils::getSelfURLhost(); $_SERVER['REQUEST_URI'] = 'example1/route?x=test'; $_SERVER['QUERY_STRING'] = '?x=test'; $url .= 'example1/route'; $this->assertEquals($url, OneLogin_Saml2_Utils::getSelfRoutedURLNoQuery()); }