NotFilter   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 6
dl 0
loc 24
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A toArray() 0 5 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Level23\Druid\Filters;
5
6
class NotFilter implements FilterInterface
7
{
8
    protected FilterInterface $filter;
9
10
    /**
11
     * NotFilter constructor.
12
     *
13
     * @param \Level23\Druid\Filters\FilterInterface $filter
14
     */
15 7
    public function __construct(FilterInterface $filter)
16
    {
17 7
        $this->filter = $filter;
18
    }
19
20
    /**
21
     * Return the filter as it can be used in the druid query.
22
     *
23
     * @return array<string,string|array<string,string|int|bool|array<mixed>>>
24
     */
25 3
    public function toArray(): array
26
    {
27 3
        return [
28 3
            'type'  => 'not',
29 3
            'field' => $this->filter->toArray(),
30 3
        ];
31
    }
32
}