Total Complexity | 5 |
Total Lines | 62 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
17 | class Terms implements Query |
||
18 | { |
||
19 | /** |
||
20 | * @var string |
||
21 | */ |
||
22 | private $field; |
||
23 | |||
24 | /** |
||
25 | * @var array |
||
26 | */ |
||
27 | private $values; |
||
28 | |||
29 | /** |
||
30 | * @var array |
||
31 | */ |
||
32 | private $lookup; |
||
33 | |||
34 | /** |
||
35 | * @param string $field |
||
36 | * @param array $values |
||
37 | */ |
||
38 | 3 | public function __construct(string $field, array $values = []) |
|
39 | { |
||
40 | 3 | $this->field = $field; |
|
41 | 3 | $this->values = \array_values($values); |
|
42 | 3 | } |
|
43 | |||
44 | /** |
||
45 | * @param string $index |
||
46 | * @param string $id |
||
47 | * @param string $path |
||
48 | * @param string $type |
||
49 | * |
||
50 | * @return self |
||
51 | */ |
||
52 | 1 | public function lookup(string $index, string $id, string $path, string $type = '_doc'): self |
|
53 | { |
||
54 | 1 | $this->lookup = [ |
|
55 | 1 | 'index' => $index, |
|
56 | 1 | 'type' => $type, |
|
57 | 1 | 'id' => $id, |
|
58 | 1 | 'path' => $path, |
|
59 | ]; |
||
60 | |||
61 | 1 | return $this; |
|
62 | } |
||
63 | |||
64 | /** |
||
65 | * {@inheritdoc} |
||
66 | */ |
||
67 | 1 | public function name(): string |
|
68 | { |
||
69 | 1 | return 'terms'; |
|
70 | } |
||
71 | |||
72 | /** |
||
73 | * {@inheritdoc} |
||
74 | */ |
||
75 | 2 | public function compile(): array |
|
79 | ]; |
||
80 | } |
||
81 | } |
||
82 |