DimensionSelectorHavingFilter::toArray()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 6
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Level23\Druid\HavingFilters;
5
6
class DimensionSelectorHavingFilter implements HavingFilterInterface
7
{
8
    protected string $dimension;
9
10
    protected string $value;
11
12
    /**
13
     * LessThanHavingFilter constructor.
14
     *
15
     * @param string $dimension
16
     * @param string $value
17
     */
18 13
    public function __construct(string $dimension, string $value)
19
    {
20 13
        $this->dimension = $dimension;
21 13
        $this->value     = $value;
22
    }
23
24
    /**
25
     * Return the having filter as it can be used in a druid query.
26
     *
27
     * @return array<string,string>
28
     */
29 9
    public function toArray(): array
30
    {
31 9
        return [
32 9
            'type'      => 'dimSelector',
33 9
            'dimension' => $this->dimension,
34 9
            'value'     => $this->value,
35 9
        ];
36
    }
37
}