public function getBaseUrl(): string
    {
        $schemeAndHttpHost = 'http';

        if ($this->isEncrypted()) {
            $schemeAndHttpHost .= 's';
        }

        $schemeAndHttpHost .= '://' . $this->server('SERVER_NAME');

        if ((!$this->isEncrypted() && $this->server('SERVER_PORT') !== '80')
            || ($this->isEncrypted() && $this->server('SERVER_PORT') !== '443'))
        {
            $schemeAndHttpHost .= ':' . $this->server('SERVER_PORT');
        }

        return $schemeAndHttpHost;
    }