Passed
Push — master ( 306b71...ebe21d )
by Teye
04:57
created

NullFilter::toArray()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

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