Lines
100.00%
3 / 3
Methods
100.00%
2 / 2
Classes
100.00%
1 / 1
| Name | Lines | Methods | CRAP | ||||
|---|---|---|---|---|---|---|---|
| __construct | 100.00% | 2 / 2 | 100.00% | 1 / 1 | 2 | ||
| getDuration | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| 12 | final readonly class HistoryWindow | |
| 13 | { | |
| 14 | /** @throws HistoryException */ | |
| 15 | public function __construct( | |
| 16 | public Instant $startsAt, | |
| 17 | public Instant $endsAt, | |
| 18 | ) { | |
| 19 | if (!$endsAt->isAfter($startsAt)) { | |
| 20 | throw HistoryException::createForReason(HistoryError::WindowInvalid, startsAt: (string) $startsAt, endsAt: (string) $endsAt); | |
| 21 | } | |
| 22 | } | |
| 23 | ||
| 24 | public function getDuration(): Duration | |
| 25 | { | |
| 26 | return $this->endsAt->elapsedSince($this->startsAt); | |
| 27 | } | |
| 28 | } |