private static function parseUrl(array $serverVars): UrlInterface
    {
        $uriAndQueryString = explode('?', self::fixRequestUri($serverVars['REQUEST_URI']), 2);
        $hostAndPort = explode(':', $serverVars['HTTP_HOST'], 2);

        return Url::fromParts(
            Scheme::parse('http' . (isset($serverVars['HTTPS']) && $serverVars['HTTPS'] !== '' && $serverVars['HTTPS'] !== 'off' ? 's' : '')),
            Host::parse($hostAndPort[0]),
            count($hostAndPort) > 1 ? intval($hostAndPort[1]) : null,
            UrlPath::parse($uriAndQueryString[0]),
            count($uriAndQueryString) > 1 ? $uriAndQueryString[1] : null
        );
    }