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

Filter::isFromDateEnabled()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 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
}