AbstractGranularity   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 2
1
<?php
2
declare(strict_types=1);
3
4
namespace Level23\Druid\Granularities;
5
6
use Level23\Druid\Types\Granularity;
7
use Level23\Druid\Collections\IntervalCollection;
8
9
abstract class AbstractGranularity
10
{
11
    protected Granularity $queryGranularity;
12
13
    protected bool $rollup;
14
15
    protected IntervalCollection $intervals;
16
17
    /**
18
     * UniformGranularity constructor.
19
     *
20
     * @param string|Granularity $queryGranularity
21
     * @param bool               $rollup
22
     * @param IntervalCollection $intervals
23
     */
24 14
    public function __construct(string|Granularity $queryGranularity, bool $rollup, IntervalCollection $intervals)
25
    {
26 14
        $this->queryGranularity = is_string($queryGranularity) ? Granularity::from(strtolower($queryGranularity)) : $queryGranularity;
27 12
        $this->rollup           = $rollup;
28 12
        $this->intervals        = $intervals;
29
    }
30
}