Exists   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 30
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A compile() 0 4 1
A name() 0 3 1
1
<?php
2
/*
3
 * This file is part of PHPinnacle/Elastics.
4
 *
5
 * (c) PHPinnacle Team <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
declare(strict_types=1);
12
13
namespace PHPinnacle\Elastics\Query;
14
15
use PHPinnacle\Elastics\Query;
16
17
class Exists implements Query
18
{
19
    /**
20
     * @var string
21
     */
22
    private $field;
23
24
    /**
25
     * @param string $field
26
     */
27 2
    public function __construct(string $field)
28
    {
29 2
        $this->field = $field;
30 2
    }
31
32
    /**
33
     * {@inheritdoc}
34
     */
35 1
    public function name(): string
36
    {
37 1
        return 'exists';
38
    }
39
40
    /**
41
     * {@inheritdoc}
42
     */
43 1
    public function compile(): array
44
    {
45
        return [
46 1
            'field' => $this->field,
47
        ];
48
    }
49
}
50