public function normalize()
    {
        // See RFC 3986, section 6

        // Scheme is case-insensitive
        if ($this->_scheme) {
            $this->_scheme = strtolower($this->_scheme);
        }

        // Hostname is case-insensitive
        if ($this->_host) {
            $this->_host = strtolower($this->_host);
        }

        // Remove default port number for known schemes (RFC 3986, section 6.2.3)
        if ('' === $this->_port
            || $this->_port
            && $this->_scheme
            && $this->_port == getservbyname($this->_scheme, 'tcp')
        ) {
            $this->_port = false;
        }

        // Normalize case of %XX percentage-encodings (RFC 3986, section 6.2.2.1)
        // Normalize percentage-encoded unreserved characters (section 6.2.2.2)
        list($this->_userinfo, $this->_host, $this->_path)
            = preg_replace_callback(
                '((?:%[0-9a-fA-Z]{2})+)', array($this, '_normalizeCallback'),
                array($this->_userinfo, $this->_host, $this->_path)
            );

        // Path segment normalization (RFC 3986, section 6.2.2.3)
        $this->_path = self::removeDotSegments($this->_path);

        // Scheme based normalization (RFC 3986, section 6.2.3)
        if (false !== $this->_host && '' === $this->_path) {
            $this->_path = '/';
        }

        // path should start with '/' if there is authority (section 3.3.)
        if (strlen($this->getAuthority())
            && strlen($this->_path)
            && $this->_path[0] !== '/'
        ) {
            $this->_path = '/' . $this->_path;
        }
    }
public function normalize()
    {
        // See RFC 3986, section 6

        // Scheme is case-insensitive
        if ($this->_scheme) {
            $this->_scheme = strtolower($this->_scheme);
        }

        // Hostname is case-insensitive
        if ($this->_host) {
            $this->_host = strtolower($this->_host);
        }

        // Remove default port number for known schemes (RFC 3986, section 6.2.3)
        if ('' === $this->_port
            || $this->_port
            && $this->_scheme
            && $this->_port == getservbyname($this->_scheme, 'tcp')
        ) {
            $this->_port = false;
        }

        // Normalize case of %XX percentage-encodings (RFC 3986, section 6.2.2.1)
        // Normalize percentage-encoded unreserved characters (section 6.2.2.2)
        list($this->_userinfo, $this->_host, $this->_path)
            = preg_replace_callback(
                '((?:%[0-9a-fA-Z]{2})+)', array($this, '_normalizeCallback'),
                array($this->_userinfo, $this->_host, $this->_path)
            );

        // Path segment normalization (RFC 3986, section 6.2.2.3)
        $this->_path = self::removeDotSegments($this->_path);

        // Scheme based normalization (RFC 3986, section 6.2.3)
        if (false !== $this->_host && '' === $this->_path) {
            $this->_path = '/';
        }

        // path should start with '/' if there is authority (section 3.3.)
        if (strlen($this->getAuthority())
            && strlen($this->_path)
            && $this->_path[0] !== '/'
        ) {
            $this->_path = '/' . $this->_path;
        }
    }
public function normalize ( ) { // See RFC 3986, section 6 // Scheme is case-insensitive if ( $ this -> _scheme ) { $ this -> _scheme = strtolower ( $ this -> _scheme ) ; } // Hostname is case-insensitive if ( $ this -> _host ) { $ this -> _host = strtolower ( $ this -> _host ) ; } // Remove default port number for known schemes (RFC 3986, section 6.2.3) if ( '' === $ this -> _port || $ this -> _port && $ this -> _scheme && $ this -> _port == getservbyname ( $ this -> _scheme , 'tcp' ) ) { $ this -> _port = false ; } // Normalize case of %XX percentage-encodings (RFC 3986, section 6.2.2.1) // Normalize percentage-encoded unreserved characters (section 6.2.2.2) list ( $ this -> _userinfo , $ this -> _host , $ this -> _path ) = preg_replace_callback ( '((?:%[0-9a-fA-Z]{2})+)' , array ( $ this , '_normalizeCallback' ) , array ( $ this -> _userinfo , $ this -> _host , $ this -> _path ) ) ; // Path segment normalization (RFC 3986, section 6.2.2.3) $ this -> _path = self :: removeDotSegments ( $ this -> _path ) ; // Scheme based normalization (RFC 3986, section 6.2.3) if ( false !== $ this -> _host && '' === $ this -> _path ) { $ this -> _path = '/' ; } // path should start with '/' if there is authority (section 3.3.) if ( strlen ( $ this -> getAuthority ( ) ) && strlen ( $ this -> _path ) && $ this -> _path [ 0 ] !== '/' ) { $ this -> _path = '/' . $ this -> _path ; } }
Normalizes the URL

See RFC 3986, Section 6.  Normalization and Comparison

@link https://tools.ietf.org/html/rfc3986#section-6

@return void
Normalizes the URL