Completed
Push — master ( 6c9334...f3ba17 )
by Simonas
02:26
created

IdsQuery::toArray()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 10
rs 9.4285
cc 1
eloc 5
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the ONGR package.
5
 *
6
 * (c) NFQ Technologies UAB <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace ONGR\ElasticsearchDSL\Query\TermLevel;
13
14
use ONGR\ElasticsearchDSL\BuilderInterface;
15
use ONGR\ElasticsearchDSL\ParametersTrait;
16
17
/**
18
 * Represents Elasticsearch "ids" query.
19
 *
20
 * @link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-ids-query.html
21
 */
22
class IdsQuery implements BuilderInterface
23
{
24
    use ParametersTrait;
25
26
    /**
27
     * @var array
28
     */
29
    private $values;
30
31
    /**
32
     * @param array $values
33
     * @param array $parameters
34
     */
35
    public function __construct(array $values, array $parameters = [])
36
    {
37
        $this->values = $values;
38
        $this->setParameters($parameters);
39
    }
40
41
    /**
42
     * {@inheritdoc}
43
     */
44
    public function getType()
45
    {
46
        return 'ids';
47
    }
48
49
    /**
50
     * {@inheritdoc}
51
     */
52
    public function toArray()
53
    {
54
        $query = [
55
            'values' => $this->values,
56
        ];
57
58
        $output = $this->processArray($query);
59
60
        return [$this->getType() => $output];
61
    }
62
}
63