MatchAllQuery::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
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;
13
14
use ONGR\ElasticsearchDSL\BuilderInterface;
15
use ONGR\ElasticsearchDSL\ParametersTrait;
16
17
/**
18
 * Represents Elasticsearch "match_all" query.
19
 *
20
 * @link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-all-query.html
21
 */
22
class MatchAllQuery implements BuilderInterface
23
{
24
    use ParametersTrait;
25
26
    /**
27
     * @param array $parameters Additional parameters.
28
     */
29
    public function __construct(array $parameters = [])
30
    {
31
        $this->setParameters($parameters);
32
    }
33
34
    /**
35
     * {@inheritdoc}
36
     */
37
    public function getType()
38
    {
39
        return 'match_all';
40
    }
41
42
    /**
43
     * {@inheritdoc}
44
     */
45
    public function toArray()
46
    {
47
        $params = $this->getParameters();
48
        return [$this->getType() => !empty($params) ? $params : new \stdClass()];
49
    }
50
}
51