Update Http.php

Cleanup a bit
This commit is contained in:
the-djmaze 2022-10-28 19:10:17 +02:00 committed by GitHub
parent 3caeae8ea6
commit 8406bd4c9f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -129,7 +129,7 @@ class Http
public function GetHost(bool $bWithRemoteUserData = false, bool $bWithoutWWW = true, bool $bWithoutPort = false) : string public function GetHost(bool $bWithRemoteUserData = false, bool $bWithoutWWW = true, bool $bWithoutPort = false) : string
{ {
$sHost = $this->GetServer('HTTP_HOST', ''); $sHost = $this->GetServer('HTTP_HOST', '');
if (0 === \strlen($sHost)) if (!\strlen($sHost))
{ {
$sName = $this->GetServer('SERVER_NAME'); $sName = $this->GetServer('SERVER_NAME');
$iPort = (int) $this->GetServer('SERVER_PORT', 80); $iPort = (int) $this->GetServer('SERVER_PORT', 80);
@ -150,7 +150,7 @@ class Http
if ($bWithoutPort) if ($bWithoutPort)
{ {
$sHost = \preg_replace('/:[\d]+$/', '', $sHost); $sHost = \preg_replace('/:\d+$/', '', $sHost);
} }
return $sHost; return $sHost;