UrlToQuery.php
function resolve( $url = '', $query_string_vars = [ ] ) {
        $url = filter_var( $url, FILTER_SANITIZE_URL );
        if ( ! empty( $url ) ) {
            $id = md5( $url . serialize( $query_string_vars ) );
            if ( ! isset( $this->items[$id] ) || ! $this->items[$id] instanceof UrlToQueryItem ) {
                $this->items[$id] = new UrlToQueryItem( $this );
            }
            $result = $this->items[$id]->resolve( $url, $query_string_vars );
        } else {
            $result = new \WP_Error( 'url-to-query-bad-url' );
        }
        return $result;
    }
function resolve( $url = '', $query_string_vars = [ ] ) {
        $url = filter_var( $url, FILTER_SANITIZE_URL );
        if ( ! empty( $url ) ) {
            $id = md5( $url . serialize( $query_string_vars ) );
            if ( ! isset( $this->items[$id] ) || ! $this->items[$id] instanceof UrlToQueryItem ) {
                $this->items[$id] = new UrlToQueryItem( $this );
            }
            $result = $this->items[$id]->resolve( $url, $query_string_vars );
        } else {
            $result = new \WP_Error( 'url-to-query-bad-url' );
        }
        return $result;
    }
function resolve ( $ url = '' , $ query_string_vars = [ ] ) { $ url = filter_var ( $ url , FILTER_SANITIZE_URL ) ; if ( ! empty ( $ url ) ) { $ id = md5 ( $ url . serialize ( $ query_string_vars ) ) ; if ( ! isset ( $ this -> items [ $ id ] ) || ! $ this -> items [ $ id ] instanceof UrlToQueryItem ) { $ this -> items [ $ id ] = new UrlToQueryItem ( $ this ) ; } $ result = $ this -> items [ $ id ] -> resolve ( $ url , $ query_string_vars ) ; } else { $ result = new \ WP_Error ( 'url-to-query-bad-url' ) ; } return $ result ; }
Resolve an url to an array of WP_Query arguments for main query

@param string $url               Url to resolve
@param type $query_string_vars   Query variables to be added to the url
@return array|\WP_Error          Resolved query or WP_Error is something goes wrong
Resolve an url to an array of WP_Query arguments for main query