Completed
Pull Request — master (#348)
by
unknown
10:14
created

ExistsQuery   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 3
c 0
b 0
f 0
lcom 1
cbo 0
dl 0
loc 37
rs 10
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
declare(strict_types=1);
13
14
namespace ONGR\ElasticsearchDSL\Query\TermLevel;
15
16
use ONGR\ElasticsearchDSL\BuilderInterface;
17
18
/**
19
 * Represents Elasticsearch "exists" query.
20
 *
21
 * @link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-exists-query.html
22
 */
23
class ExistsQuery implements BuilderInterface
24
{
25
    public function __construct(private string $field)
0 ignored issues
show
Bug introduced by
This code did not parse for me. Apparently, there is an error somewhere around this line:

Syntax error, unexpected T_PRIVATE, expecting T_VARIABLE
Loading history...
26
    {
27
    }
28
29
    public function getType(): string
30
    {
31
        return 'exists';
32
    }
33
34
    public function toArray(): array
35
    {
36
        return [
37
            $this->getType() => [
38
                'field' => $this->field,
39
            ],
40
        ];
41
    }
42
}
43