Completed
Push — develop ( f07ae4...5325d9 )
by Sam
05:38 queued 03:06
created

TermsQuery::getField()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php namespace Nord\Lumen\Elasticsearch\Search\Query\TermLevel;
2
3
/**
4
 * Filters documents that have fields that match any of the provided terms (not analyzed).
5
 *
6
 * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-terms-query.html
7
 */
8
class TermsQuery extends AbstractQuery
9
{
10
11
    /**
12
     * @var array
13
     */
14
    private $values;
15
16
17
    /**
18
     * @inheritdoc
19
     */
20
    public function toArray()
21
    {
22
        return [
23
            'terms' => [
24
                $this->getField() => $this->getValues()
25
            ]
26
        ];
27
    }
28
29
30
    /**
31
     * @param array $values
32
     * @return TermsQuery
33
     */
34
    public function setValues($values)
35
    {
36
        $this->values = $values;
37
        return $this;
38
    }
39
40
41
    /**
42
     * @return array
43
     */
44
    public function getValues()
45
    {
46
        return $this->values;
47
    }
48
}
49