@param string $uri
@param string $query

@return string
351076
public function buildCacheKey(string $uri, string $query = ''): string
    {

        if ($query != '')
            $query = $this->hashString($query);

        return $this->prefix . $this->hashString($uri . $query);
    }
1224124
static function parse_str($query)
    {
        if ($query === null) {
            return null;
        }

        $parts = explode('&', $query);

        $new_parts = array();
        for ($i = 0; $i < count($parts); $i++) {
            $pair = explode('=', $parts[$i]);

            if (count($pair) != 2) {
                continue;
            }

            list($key, $value) = $pair;
            $new_parts[urldecode($key)] = urldecode($value);
        }

        return $new_parts;
    }
189393
public URI documentUri(String documentId, Map<String, Object> query)  {
        String base_uri = String.format(
                "%s/%s",
                this.rootUriString,
                this.encodeId(documentId)
        );
        String uri = appendQueryString(base_uri, query);
        return uriFor(uri);
    }
812864
public function withQuery(string $query): URI
    {
        $result = clone $this;
        $result->query = $this->filterQuery($query);

        return $result;
    }
1359208
public function get(string $uri, string $query = '')
    {

        if (! $this->has($uri, $query))
            return false;

        $data = unserialize($this->redis
            ->get($this->buildCacheKey($uri, $query)));

        // If the cached entry is expired and does not have any ETag, remove it.
        if ($data->expired() && ! $data->hasHeader('ETag')) {

            $this->forget($uri, $query);

            return false;
        }

        return $data;
    }
1118797
public function post($uri, $query)
    {
        $this->client->post($uri, $query);

        return $this->createResponse();
    }
933068
private function http_build_query($query) {
        $uri = [];
        foreach($query as $k => $v) {
            array_push($uri, $k . '='. $v);
        }

        return implode('&', $uri);
    }
187492
public function forget(string $uri, string $query = '')
    {

        $path = $this->buildRelativePath($uri, $query);
        $cache_file_path = $path . $this->results_filename;

        @unlink($cache_file_path);
    }
1334224
public final function withQuery($query): UriInterface
   {
       if (!is_string($query)) {
           throw new InvalidArgumentException(
               "Can't get with query: invalid query string");
       }
       return $this->with("query", $this->parseQuery($query));
   }
79001
function requestURI( $uri )
    {
        $parsed = parse_url( $uri );

        $return = '';
        if ( isset( $parsed['user'] ) )
        {
            $return .= $parsed['user'] . '@' . $parsed['pass'];
        }
        $return .= rtrim( $parsed['path'], '/' ) . '/' . $this->Name;

        if ( isset( $parsed['query'] ) )
        {
            $return  .= '?' . $parsed['query'];
        }
        if ( isset( $parsed['fragment'] ) )
        {
            $return .= '#' . $parsed['fragment'];
        }

        return $return;
    }
642521
public function getQueryParam(UriInterface $uri, $param)
    {
        if (!$query = $uri->getQuery()) {
            return null;
        }

        parse_str($query, $params);
        if (!array_key_exists($param, $params)) {
            return null;
        }

        return $params[$param];
    }
724176
private function buildUrl($query, $units, $lang, $appid, $mode, $url)
    {
        $queryUrl = $this->buildQueryUrlParameter($query);

        $url = $url."$queryUrl&units=$units&lang=$lang&mode=$mode&APPID=";
        $url .= empty($appid) ? $this->apiKey : $appid;

        return $url;
    }
1250634
protected function appendQuery($url, $query)
    {
        $query = trim($query, '?&');

        if ($query) {
            $glue = strstr($url, '?') === false ? '?' : '&';
            return $url . $glue . $query;
        }

        return $url;
    }
757042
public static function quoteUrl($query) {
        $queryParts = explode(' ', Str::assert($query, 'query'));

        return trim(array_reduce($queryParts, function($carry, $part) {
            return $carry . (Url::is($part) ? ('"' . $part . '" ') : ($part . ' '));
        }));
    }
1350465
public function forget(string $uri, string $query = '')
    {

        return $this->memcached->delete($this->buildCacheKey($uri, $query));
    }
706224
public function get(string $uri, string $query = '')
    {

        $path = $this->buildRelativePath($this->safePath($uri), $query);
        $cache_file_path = $path . $this->results_filename;

        // If we cant read from the cache, then just return false.
        if (! is_readable($cache_file_path))
            return false;

        // Get the data from the file and unserialize it
        $file = unserialize(file_get_contents($cache_file_path));

        // If the cached entry is expired and does not have any ETag, remove it.
        if ($file->expired() && ! $file->hasHeader('ETag')) {

            $this->forget($uri, $query);

            return false;
        }

        return $file;
    }
466038
public function parse_request($uri, \WP_Query &$wp_query = null){
        // Set wp_query if exists
        if( !is_null($wp_query) ){
            $this->wp_query = $wp_query;
        }
        // Parse URI
        $uri = explode('/', trim($uri, '/'));
        $method = array_shift($uri);
        $request_method = $this->input->request_method();
        $this->handle_request($method, $request_method, $uri);
    }