public function CasServerConfig::getServerBaseUrl in CAS 8
Same name and namespace in other branches
- 2.x src/CasServerConfig.php \Drupal\cas\CasServerConfig::getServerBaseUrl()
Construct the base URL to the CAS server.
Return value
string The base URL.
File
- src/
CasServerConfig.php, line 262
Class
- CasServerConfig
- Class CasServerConfig.
Namespace
Drupal\casCode
public function getServerBaseUrl() {
$httpScheme = $this
->getHttpScheme();
$url = $httpScheme . '://' . $this
->getHostname();
// Only append port if it's non standard.
$port = $this
->getPort();
if ($httpScheme === 'http' && $port !== 80 || $httpScheme === 'https' && $port !== 443) {
$url .= ':' . $port;
}
$url .= $this
->getPath();
$url = rtrim($url, '/') . '/';
return $url;
}