Passed
Push — master ( d21404...27166b )
by Alessandro
56s queued 11s
created

Filter   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 72
Duplicated Lines 0 %

Coupling/Cohesion

Components 4
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 10
lcom 4
cbo 0
dl 0
loc 72
ccs 24
cts 24
cp 1
rs 10
c 0
b 0
f 0

10 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A createFromArray() 0 4 1
A isFromColumnEnabled() 0 4 1
A isToColumnEnabled() 0 4 1
A isFromDateEnabled() 0 4 1
A isToDateEnabled() 0 4 1
A getFromColumn() 0 4 1
A getToColumn() 0 4 1
A getFromDate() 0 4 1
A getToDate() 0 4 1
1
<?php
2
3
4
namespace TrelloCycleTime;
5
6
7
class Filter
8
{
9
    private $fromColumn;
10
    private $toColumn;
11
    private $fromDate;
12
    private $toDate;
13
14 6
    private function __construct(array $filters)
15
    {
16 6
        $this->fromColumn = $filters['fromColumn'] ?? null;
17 6
        $this->toColumn = $filters['toColumn'] ?? null;
18 6
        $this->fromDate= $filters['fromDate'] ?? null;
19 6
        $this->toDate = $filters['toDate'] ?? null;
20 6
    }
21
22 6
    public static function createFromArray(array $filters) :Filter
23
    {
24 6
        return new self($filters);
25
    }
26
27 5
    public function isFromColumnEnabled() :bool
28
    {
29 5
        return $this->fromColumn !== null;
30
    }
31
32 2
    public function isToColumnEnabled() :bool
33
    {
34 2
        return $this->toColumn !== null;
35
    }
36
37 4
    public function isFromDateEnabled() :bool
38
    {
39 4
        return $this->fromDate !== null;
40
    }
41
42 4
    public function isToDateEnabled() :bool
43
    {
44 4
        return $this->toDate !== null;
45
    }
46
47
    /**
48
     * @return string|null
49
     */
50 1
    public function getFromColumn(): ?string
51
    {
52 1
        return $this->fromColumn;
53
    }
54
55
    /**
56
     * @return string|null
57
     */
58 1
    public function getToColumn(): ?string
59
    {
60 1
        return $this->toColumn;
61
    }
62
63
    /**
64
     * @return string|null
65
     */
66 1
    public function getFromDate(): ?string
67
    {
68 1
        return $this->fromDate;
69
    }
70
71
    /**
72
     * @return string|null
73
     */
74 1
    public function getToDate(): ?string
75
    {
76 1
        return $this->toDate;
77
    }
78
}