code/http/url/url.php
public function toArray($parts = self::FULL, $escape = null)
    {
        $result = array();
        $escape = isset($escape) ? (bool) $escape : $this->isEscaped();

        if (($parts & self::SCHEME) && !empty($this->scheme)) {
            $result['scheme'] = $this->scheme;
        }

        if (($parts & self::USER) && !empty($this->user)) {
            $result['user'] = $this->user;
        }

        if (($parts & self::PASS) && !empty($this->pass)) {
            $result['user'] = $this->pass;
        }

        if (($parts & self::PORT) && !empty($this->port)) {
            $result['port'] = $this->port;
        }

        if (($parts & self::HOST) && !empty($this->host)) {
            $result['host'] = $this->host;
        }

        if (($parts & self::PATH) && !empty($this->_path)) {
            $result['path'] = $this->_path;
        }

        if (($parts & self::QUERY) && !empty($this->_query)) {
            $result['query'] = $this->getQuery(false, $escape);
        }

        if (($parts & self::FRAGMENT) && trim($this->fragment) !== '') {
            $result['fragment'] = $this->fragment;
        }

        return $result;
    }
public function toArray($parts = self::FULL, $escape = null)
    {
        $result = array();
        $escape = isset($escape) ? (bool) $escape : $this->isEscaped();

        if (($parts & self::SCHEME) && !empty($this->scheme)) {
            $result['scheme'] = $this->scheme;
        }

        if (($parts & self::USER) && !empty($this->user)) {
            $result['user'] = $this->user;
        }

        if (($parts & self::PASS) && !empty($this->pass)) {
            $result['user'] = $this->pass;
        }

        if (($parts & self::PORT) && !empty($this->port)) {
            $result['port'] = $this->port;
        }

        if (($parts & self::HOST) && !empty($this->host)) {
            $result['host'] = $this->host;
        }

        if (($parts & self::PATH) && !empty($this->_path)) {
            $result['path'] = $this->_path;
        }

        if (($parts & self::QUERY) && !empty($this->_query)) {
            $result['query'] = $this->getQuery(false, $escape);
        }

        if (($parts & self::FRAGMENT) && trim($this->fragment) !== '') {
            $result['fragment'] = $this->fragment;
        }

        return $result;
    }
public function toArray ( $ parts = self :: FULL , $ escape = null ) { $ result = array ( ) ; $ escape = isset ( $ escape ) ? ( bool ) $ escape : $ this -> isEscaped ( ) ; if ( ( $ parts & self :: SCHEME ) && ! empty ( $ this -> scheme ) ) { $ result [ 'scheme' ] = $ this -> scheme ; } if ( ( $ parts & self :: USER ) && ! empty ( $ this -> user ) ) { $ result [ 'user' ] = $ this -> user ; } if ( ( $ parts & self :: PASS ) && ! empty ( $ this -> pass ) ) { $ result [ 'user' ] = $ this -> pass ; } if ( ( $ parts & self :: PORT ) && ! empty ( $ this -> port ) ) { $ result [ 'port' ] = $ this -> port ; } if ( ( $ parts & self :: HOST ) && ! empty ( $ this -> host ) ) { $ result [ 'host' ] = $ this -> host ; } if ( ( $ parts & self :: PATH ) && ! empty ( $ this -> _path ) ) { $ result [ 'path' ] = $ this -> _path ; } if ( ( $ parts & self :: QUERY ) && ! empty ( $ this -> _query ) ) { $ result [ 'query' ] = $ this -> getQuery ( false , $ escape ) ; } if ( ( $ parts & self :: FRAGMENT ) && trim ( $ this -> fragment ) !== '' ) { $ result [ 'fragment' ] = $ this -> fragment ; } return $ result ; }
Return the url components

@param integer $parts   A bitmask of binary or'ed HTTP_URL constants; FULL is the default
@param boolean|null $escape  If TRUE escapes '&' to '&amp;' for xml compliance. If NULL use the default.
@return array Associative array like parse_url() returns.
@see parse_url()
Return the url components