HasSegmentGranularity   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A segmentGranularity() 0 5 2
1
<?php
2
declare(strict_types=1);
3
4
namespace Level23\Druid\Concerns;
5
6
use Level23\Druid\Types\Granularity;
7
8
trait HasSegmentGranularity
9
{
10
    /**
11
     * @var null|Granularity
12
     */
13
    protected ?Granularity $segmentGranularity = null;
14
15
    /**
16
     * @param string|Granularity $segmentGranularity
17
     *
18
     * @return $this
19
     */
20 13
    public function segmentGranularity(string|Granularity $segmentGranularity): self
21
    {
22 13
        $this->segmentGranularity = is_string($segmentGranularity) ? Granularity::from(strtolower($segmentGranularity)) : $segmentGranularity;
23
24 13
        return $this;
25
    }
26
}