Conditions | 4 |
Paths | 8 |
Total Lines | 14 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
38 | public function isActive(): bool |
||
39 | { |
||
40 | $today = new DateTime(); |
||
41 | $afterStart = true; |
||
42 | $beforeEnd = true; |
||
43 | if ($this->startDate instanceof DateTimeInterface) { |
||
44 | $afterStart = $today->getTimestamp() > $this->startDate->getTimestamp(); |
||
45 | } |
||
46 | |||
47 | if ($this->endDate instanceof DateTimeInterface) { |
||
48 | $beforeEnd = $today->getTimestamp() < $this->endDate->getTimestamp(); |
||
49 | } |
||
50 | |||
51 | return $afterStart && $beforeEnd; |
||
52 | } |
||
54 |