| 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 | 29 | public function __construct( |
|
| 18 | PointInTimeInterface $start, |
||
| 19 | PointInTimeInterface $end |
||
| 20 | ) { |
||
| 21 | 29 | if ($start->aheadOf($end)) { |
|
| 22 | 1 | throw new LogicException; |
|
| 23 | } |
||
| 24 | |||
| 25 | 28 | if ($start->equals($end)) { |
|
| 26 | 1 | throw new EmptySlot; |
|
| 27 | } |
||
| 28 | |||
| 29 | 27 | $this->start = $start; |
|
| 30 | 27 | $this->end = $end; |
|
| 31 | 27 | } |
|
| 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 |