QueryHavingFilter   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 6
dl 0
loc 19
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
use Level23\Druid\Filters\FilterInterface;
7
8
class QueryHavingFilter implements HavingFilterInterface
9
{
10
    protected FilterInterface $filter;
11
12 4
    public function __construct(FilterInterface $filter)
13
    {
14 4
        $this->filter = $filter;
15
    }
16
17
    /**
18
     * Return the having filter as it can be used in a druid query.
19
     *
20
     * @return array<string,string|array<string,string|int|bool|array<mixed>>>
21
     */
22 3
    public function toArray(): array
23
    {
24 3
        return [
25 3
            'type'   => 'filter',
26 3
            'filter' => $this->filter->toArray(),
27 3
        ];
28
    }
29
}