NotHavingFilter   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\HavingFilters;
5
6
class NotHavingFilter implements HavingFilterInterface
7
{
8
    protected HavingFilterInterface $filter;
9
10
    /**
11
     * NotHavingFilter constructor.
12
     *
13
     * @param HavingFilterInterface $filter
14
     */
15 6
    public function __construct(HavingFilterInterface $filter)
16
    {
17 6
        $this->filter = $filter;
18
    }
19
20
    /**
21
     * Return the having filter as it can be used in a druid query.
22
     *
23
     * @return array<string,string|array<string,string|float|array<mixed>|bool>>
24
     */
25 6
    public function toArray(): array
26
    {
27 6
        return [
28 6
            'type'       => 'not',
29 6
            'havingSpec' => $this->filter->toArray(),
30 6
        ];
31
    }
32
}