public function getAuthority()
    {
        $scheme = $this->getScheme();
        $serverName = $this->getHost();
        $serverPort = $this->getPort();

        $authority = sprintf('%s://%s', $scheme, $serverName);
        if (('https' === $scheme && 443 !== $serverPort) || ('http' === $scheme && 80 !== $serverPort)) {
            $authority .= sprintf(':%d', $serverPort);
        }

        return $authority;
    }