src/Consumer.php
public static function getNormalizedUrl(Url $url)
    {
        $scheme = $url->getScheme();
        $host   = $url->getHost();
        $port   = $url->getPort();
        $path   = $url->getPath();

        // no port for 80 (http) and 443 (https)
        if ((($port == 80 || empty($port)) && strcasecmp($scheme, 'http') == 0) || (($port == 443 || empty($port)) && strcasecmp($scheme, 'https') == 0)) {
            $normalizedUrl = $scheme . '://' . $host . $path;
        } else {
            if (!empty($port)) {
                $normalizedUrl = $scheme . '://' . $host . ':' . $port . $path;
            } else {
                throw new RuntimeException('No port specified');
            }
        }

        return strtolower($normalizedUrl);
    }
public static function getNormalizedUrl(Url $url)
    {
        $scheme = $url->getScheme();
        $host   = $url->getHost();
        $port   = $url->getPort();
        $path   = $url->getPath();

        // no port for 80 (http) and 443 (https)
        if ((($port == 80 || empty($port)) && strcasecmp($scheme, 'http') == 0) || (($port == 443 || empty($port)) && strcasecmp($scheme, 'https') == 0)) {
            $normalizedUrl = $scheme . '://' . $host . $path;
        } else {
            if (!empty($port)) {
                $normalizedUrl = $scheme . '://' . $host . ':' . $port . $path;
            } else {
                throw new RuntimeException('No port specified');
            }
        }

        return strtolower($normalizedUrl);
    }
Normalize the url like defined in

@see http://tools.ietf.org/html/rfc5849#section-3.4.1.2
@param \PSX\Uri\Url $url
@return string