Passed
Push — master ( 5ee49d...ede548 )
by Alessandro
01:05 queued 11s
created

Filter   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 6
lcom 2
cbo 0
dl 0
loc 42
ccs 14
cts 14
cp 1
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A createFromArray() 0 4 1
A isFromColumnEnabled() 0 4 1
A isToColumnEnabled() 0 4 1
A getFromColumn() 0 4 1
A getToColumn() 0 4 1
1
<?php
2
3
4
namespace TrelloCycleTime;
5
6
7
class Filter
8
{
9
    private $fromColumn;
10
    private $toColumn;
11
12 5
    private function __construct(array $filters)
13
    {
14 5
        $this->fromColumn = $filters['fromColumn'] ?? null;
15 5
        $this->toColumn = $filters['toColumn'] ?? null;
16 5
    }
17
18 5
    public static function createFromArray(array $filters) :Filter
19
    {
20 5
        return new self($filters);
21
    }
22
23 5
    public function isFromColumnEnabled() :bool
24
    {
25 5
        return $this->fromColumn !== null;
26
    }
27
28 2
    public function isToColumnEnabled() :bool
29
    {
30 2
        return $this->toColumn !== null;
31
    }
32
33
    /**
34
     * @return string|null
35
     */
36 1
    public function getFromColumn(): ?string
37
    {
38 1
        return $this->fromColumn;
39
    }
40
41
    /**
42
     * @return string|null
43
     */
44 1
    public function getToColumn(): ?string
45
    {
46 1
        return $this->toColumn;
47
    }
48
}