NotFilter::toArray()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 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
}