Passed
Pull Request — master (#52)
by Teye
07:22 queued 03:03
created

NullFilter   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 8
c 1
b 0
f 0
dl 0
loc 29
ccs 8
cts 8
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A toArray() 0 8 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Level23\Druid\Filters;
5
6
use Level23\Druid\Extractions\ExtractionInterface;
7
8
/**
9
 * Class NullFilter
10
 *
11
 * @see     https://druid.apache.org/docs/latest/querying/filters#null-filter
12
 * @package Level23\Druid\Filters
13
 */
14
class NullFilter implements FilterInterface
15
{
16
    protected string $column;
17
18
    protected ?ExtractionInterface $extractionFunction;
19
20
    /**
21
     * NullFilter constructor.
22
     *
23
     * @param string $column Input column or virtual column name to filter.
24
     */
25 1
    public function __construct(string $column)
26
    {
27 1
        $this->column = $column;
28
    }
29
30
    /**
31
     * Return the filter as it can be used in the druid query.
32
     *
33
     * @return array<string,string|array<string,string|int|bool|array<mixed>>>
34
     */
35 1
    public function toArray(): array
36
    {
37 1
        $result = [
38 1
            'type'   => 'null',
39 1
            'column' => $this->column,
40 1
        ];
41
42 1
        return $result;
43
    }
44
}