Total Complexity | 10 |
Total Lines | 66 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
12 | final class Slot |
||
13 | { |
||
14 | private $start; |
||
15 | private $end; |
||
16 | |||
17 | 31 | public function __construct( |
|
18 | PointInTimeInterface $start, |
||
19 | PointInTimeInterface $end |
||
20 | ) { |
||
21 | 31 | if ($start->aheadOf($end)) { |
|
22 | 1 | throw new LogicException; |
|
23 | } |
||
24 | |||
25 | 30 | if ($start->equals($end)) { |
|
26 | 1 | throw new EmptySlot; |
|
27 | } |
||
28 | |||
29 | 29 | $this->start = $start; |
|
30 | 29 | $this->end = $end; |
|
31 | 29 | } |
|
32 | |||
33 | 15 | public function start(): PointInTimeInterface |
|
34 | { |
||
35 | 15 | return $this->start; |
|
36 | } |
||
37 | |||
38 | 9 | public function end(): PointInTimeInterface |
|
41 | } |
||
42 | |||
43 | 9 | public function overlaps(self $slot): bool |
|
78 | } |
||
79 | } |
||
80 |