NotHavingFilter::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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