TransformBuilder   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 6
c 0
b 0
f 0
dl 0
loc 34
ccs 5
cts 5
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A transform() 0 5 1
A getTransforms() 0 3 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Level23\Druid\Transforms;
5
6
use Level23\Druid\Concerns\HasFilter;
7
8
class TransformBuilder
9
{
10
    use HasFilter;
11
12
    /**
13
     * @var array|\Level23\Druid\Transforms\TransformInterface[]
14
     */
15
    protected array $transforms = [];
16
17
    /**
18
     * Build a new transform.
19
     *
20
     * For all the available options in expressions, see this link:
21
     *
22
     * @see https://druid.apache.org/docs/latest/misc/math-expr.html
23
     *
24
     * @param string $expression
25
     * @param string $as
26
     *
27
     * @return self
28
     */
29 2
    public function transform(string $expression, string $as): self
30
    {
31 2
        $this->transforms[] = new ExpressionTransform($expression, $as);
32
33 2
        return $this;
34
    }
35
36
    /**
37
     * @return array|\Level23\Druid\Transforms\TransformInterface[]
38
     */
39 3
    public function getTransforms(): array
40
    {
41 3
        return $this->transforms;
42
    }
43
}