Returns the results
parsed as DOMDocument

@param array $query Extra URL parameters

@return DOMDocument
340429
public function getDomDocumentResponse(array $query = array())
    {
        $xml = new DOMDocument();
        $xml->loadXML($this->getResponse($query));
        return $xml;
    }
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;
    }
273013
public function parseNode($query, $node)
    {
        if ($node instanceof Nodes\KeyNode) {
            return $this->parseKey($node->getValue());
        }

        if ($node instanceof Nodes\ValueNode) {
            return $this->parseValue($node->getValue());
        }

        if ($node instanceof Nodes\FunctionNode) {
            // .. ?

            $f = $this->getBuilder()->getFunctions()->first(function ($item, $key) use ($node) {
                $class = $item->getNode();

                return $node instanceof $class;
            });

            if (!$f) {
                throw new \Railken\SQ\Exceptions\QuerySyntaxException();
            }

            $childs = new Collection();

            foreach ($node->getChildren() as $child) {
                $childs[] = $this->parseNode($query, $child);
            }

            $childs = $childs->map(function ($v) use ($query) {
                if ($v instanceof \Illuminate\Database\Query\Expression) {
                    return $v->getValue();
                }

                $query->addBinding($v, 'where');

                return '?';
            });

            return DB::raw($f->getName().'('.$childs->implode(',').')');
        }
    }
201745
protected function _getPageUrl(array $query = array())
    {
        $url = $this->getUrl();

        if ($query) {
            $url->setQuery(array_merge($url->getQuery(true), $query));
        }

        return (string) $url;
    }
1238281
public function current(array $query = array())
    {
        if(!$this->request)
            throw new \Exedra\Exception\InvalidArgumentException('Http Request does not exist.');

        $uri = $this->request->getUri();

        if(count($query) > 0)
        {
            // append query to uri
            if($uri->getQuery())
                $query = http_build_query($query);
            else
                $query = '?' . http_build_query($query);
        }
        else
        {
            $query = '';
        }

        return $this->request->getUri().$query;
    }
171858
public function addQuery(array $query)
    {
        $queryParts = [];
        foreach ($query as $key => $value) {
            $queryParts[] = "{$key}={$value}";
        }

        $this->fullUrl['query'] = '?' . implode('&', $queryParts);

        return $this;
    }
380954
public function prepareQueryOrNewObj(array $query)
    {
        $preparedQuery = array();

        foreach ($query as $key => $value) {
            // Recursively prepare logical query clauses
            if (in_array($key, array('$and', '$or', '$nor')) && is_array($value)) {
                foreach ($value as $k2 => $v2) {
                    $preparedQuery[$key][$k2] = $this->prepareQueryOrNewObj($v2);
                }
                continue;
            }

            if (isset($key[0]) && $key[0] === '$' && is_array($value)) {
                $preparedQuery[$key] = $this->prepareQueryOrNewObj($value);
                continue;
            }

            list($key, $value) = $this->prepareQueryElement($key, $value, null, true);

            $preparedQuery[$key] = is_array($value)
                ? array_map('Doctrine\ODM\MongoDB\Types\Type::convertPHPToDatabaseValue', $value)
                : Type::convertPHPToDatabaseValue($value);
        }

        return $preparedQuery;
    }
970942
public static function query($dom, $query, $context = null)
    {
        $xpath = new DOMXPath($dom);
        $xpath->registerNamespace('samlp', OneLogin_Saml2_Constants::NS_SAMLP);
        $xpath->registerNamespace('saml', OneLogin_Saml2_Constants::NS_SAML);
        $xpath->registerNamespace('ds', OneLogin_Saml2_Constants::NS_DS);
        $xpath->registerNamespace('xenc', OneLogin_Saml2_Constants::NS_XENC);
        $xpath->registerNamespace('xsi', OneLogin_Saml2_Constants::NS_XSI);
        $xpath->registerNamespace('xs', OneLogin_Saml2_Constants::NS_XS);
        $xpath->registerNamespace('md', OneLogin_Saml2_Constants::NS_MD);

        if (isset($context)) {
            $res = $xpath->query($query, $context);
        } else {
            $res = $xpath->query($query);
        }
        return $res;
    }
284735
public function xpath(string $xpath_query)
    {
        $result = $this->createChildInstance();

        if (isset($this->document)) {
            $result->xpath_query = $xpath_query;

            if (isset($this->root_instance) || isset($this->xpath_query)) {  // all nodes as context
                foreach ($this->nodes as $node) {
                    if ($result_node_list = $this->xpathQuery('.'.$xpath_query, $node)) {
                        $result->loadDomNodeList($result_node_list);
                    }
                }
            } else { // whole document
                if ($result_node_list = $this->xpathQuery($xpath_query)) {
                    $result->loadDomNodeList($result_node_list);
                }
            }
        }

        return $result;
    }
1133121
protected function query_parse($query)
    {
        $start = $this->options['identifier_start'];
        $end   = $this->options['identifier_end'];
        $quote = self::DEFAULT_QUOTE;

        if ($start == $quote) {
            return $query;
        }

        $pos = 0;
        $in  = false;

        while ($pos = strpos($query, $quote, $pos)) {
            if ($query[$pos+1] == $quote) {  // skip escaped quote
                $pos += 2;
            }
            else {
                if ($in) {
                    $q  = $end;
                    $in = false;
                }
                else {
                    $q  = $start;
                    $in = true;
                }

                $query = substr_replace($query, $q, $pos, 1);
                $pos++;
            }
        }

        return $query;
    }
41972
public static function find(array $query)
    {
        if (isset($query['semester']) &&
            $query['semester'] instanceof Semester) {
            $query['semester'] = $query['semester']->daisyFormat();
        }
        $csis = Client::get("courseSegment", $query);
        return array_map(function ($data) { return new self($data); }, $csis);
    }
192178
public function getList(array $query = [])
    {
        $resource = self::DOMUSERP_API_OPERACIONAL . '/' . $this->cityId .'/bairros';
        $list = $this->pagination($resource);

        return $list;
    }
1076673
public function search($query) {
        global $CFG;
        if ($result = parent::search($query)) {
            return $result;
        }

        $found = false;
        $repositories= core_component::get_plugin_list('repository');
        foreach ($repositories as $p => $dir) {
            if (strpos($p, $query) !== false) {
                $found = true;
                break;
            }
        }
        if (!$found) {
            foreach (repository::get_types() as $instance) {
                $title = $instance->get_typename();
                if (strpos(core_text::strtolower($title), $query) !== false) {
                    $found = true;
                    break;
                }
            }
        }

        if ($found) {
            $result = new stdClass();
            $result->page     = $this;
            $result->settings = array();
            return array($this->name => $result);
        } else {
            return array();
        }
    }
931142
public function getResults($query)
    {
        $searchResults = [];

        if ($query == '') {
            return $searchResults;
        }

        if ($this->searchEngineId == '') {
            throw new \Exception('You must specify a searchEngineId');
        }

        $client = new Client();
        $result = $client->get('http://www.google.com/cse', ['query' => ['cx' => $this->searchEngineId,
                'client' => 'google-csbe',
                'num' => 20,
                'output' => 'xml_no_dtd',
                'q' => $query,
            ],
        ]);

        if ($result->getStatusCode() != 200) {
            throw new Exception('Resultcode was not ok: '.$result->getStatusCode());
        }

        $xml = simplexml_load_string($result->getBody());

        if ($xml->ERROR) {
            throw new Exception('XML indicated service error: '.$xml->ERROR);
        }

        if ($xml->RES->R) {
            $i = 0;
            foreach ($xml->RES->R as $item) {
                $searchResults[$i]['name'] = (string) $item->T;
                $searchResults[$i]['url'] = (string) $item->U;
                $searchResults[$i]['snippet'] = (string) $item->S;
                $searchResults[$i]['image'] = $this->getPageMapProperty($item, 'cse_image', 'src');

                $searchResults[$i]['product']['name'] = $this->getPageMapProperty($item, 'product', 'name');
                $searchResults[$i]['product']['brand'] = $this->getPageMapProperty($item, 'product', 'brand');
                $searchResults[$i]['product']['price'] = $this->getPageMapProperty($item, 'product', 'price');
                $searchResults[$i]['product']['image'] = $this->getPageMapProperty($item, 'product', 'image');
                $searchResults[$i]['product']['identifier'] = $this->getPageMapProperty($item, 'product', 'identifier');

                $searchResults[$i]['offer']['price'] = $this->getPageMapProperty($item, 'offer', 'price');
                $searchResults[$i]['offer']['pricecurrency'] = $this->getPageMapProperty($item, 'offer', 'pricecurrency');

                ++$i;
            }
        }

        return $searchResults;
    }
1172785
public static function query($query)
    {
        //
        static::applySchema();

        //
        $table = self::getTable();
        $whereArray = [];

        //
        if (isset($query['where'])) {
            $whereArray[] = '('.$query['where'].')';
            unset($query['where']);
        }

        //
        foreach ($query as $field => $value) {
            if (in_array($field, ['order', 'limit'])) {
                continue;
            }
            $whereArray[] = "{$field} = '{$value}'";
        }

        //
        $where = count($whereArray) > 0 ? 'WHERE '.implode(' AND ', $whereArray) : '';
        $order = isset($query['order']) ? 'ORDER BY '.$query['order'] : '';
        $limit = isset($query['limit']) ? 'LIMIT '.$query['limit'] : '';
        $sql = "SELECT * FROM {$table} {$where} {$order} {$limit}";
        $results = static::getDatabase()->getResults($sql);

        //
        foreach ($results as &$record) {
            $record = static::create($record);
        }

        return $results;
    }
806377
public function getSignature(array $query = array())
    {
        switch ($this->signature) {
            case self::HMAC_SHA1:
                return $this->getHmacSha1Signature($query);
            case self::RSA_SHA1:
            case self::PLAIN_TEXT:
            default:
                return $this->getHmacPlainTextSignature();
        }
    }
712001
private function parseQuery($query) {
        if (is_array($query)) {
            return $query;
        }

        // "+" sign is reserved and must always be encoded,
        // otherwise it is interpreted as a space
        $queryString = str_replace('+', '%2B', $query);
        parse_str($queryString, $query);

        return $query;
    }