src/Message/Server/RequestUriFactory.php
private function generateUrl()
    {
        $hostHeader = $this->request->getHeaderLine('host');
        $defaultHost = strlen($hostHeader) > 0 ? $hostHeader : 'unknown-host';
        $host = $this->getServerParam('SERVER_NAME', $defaultHost);
        $scheme = $this->getServerParam('REQUEST_SCHEME', 'http');
        $uri = $this->getServerParam('REQUEST_URI', '/');
        $port = $this->getServerParam('SERVER_PORT', '80');

        $port = in_array($port, ['80', '443']) ? '' : ":{$port}";

        return "{$scheme}://{$host}{$port}{$uri}";
    }
private function generateUrl()
    {
        $hostHeader = $this->request->getHeaderLine('host');
        $defaultHost = strlen($hostHeader) > 0 ? $hostHeader : 'unknown-host';
        $host = $this->getServerParam('SERVER_NAME', $defaultHost);
        $scheme = $this->getServerParam('REQUEST_SCHEME', 'http');
        $uri = $this->getServerParam('REQUEST_URI', '/');
        $port = $this->getServerParam('SERVER_PORT', '80');

        $port = in_array($port, ['80', '443']) ? '' : ":{$port}";

        return "{$scheme}://{$host}{$port}{$uri}";
    }
Generates an URL from current request data

@return string