1<?php
2
3namespace Elastica\Query;
4
5/**
6 * Simple query
7 * Pure php array query. Can be used to create any not existing type of query.
8 *
9 * @author Nicolas Ruflin <spam@ruflin.com>
10 */
11class Simple extends AbstractQuery
12{
13    /**
14     * Query.
15     *
16     * @var array Query
17     */
18    protected $_query = [];
19
20    /**
21     * Constructs a query based on an array.
22     *
23     * @param array $query Query array
24     */
25    public function __construct(array $query)
26    {
27        $this->setQuery($query);
28    }
29
30    /**
31     * Sets new query array.
32     *
33     * @param array $query Query array
34     *
35     * @return $this
36     */
37    public function setQuery(array $query): self
38    {
39        $this->_query = $query;
40
41        return $this;
42    }
43
44    /**
45     * {@inheritdoc}
46     */
47    public function toArray(): array
48    {
49        return $this->_query;
50    }
51}
52