Lines
100.00%
2 / 2
Functions and Methods
100.00%
2 / 2
Classes and Traits
100.00%
1 / 1
| Name | Lines | Functions and Methods | CRAP | Classes and Traits | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| ScheduledRun | 100.00% | 2 / 2 | 100.00% | 2 / 2 | 2 | 100.00% | 1 / 1 | |||
| __construct | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | |||||
| getLateness | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | |||||
| 1 | <?php | |
| 2 | ||
| 3 | declare(strict_types=1); | |
| 4 | ||
| 5 | namespace Stewart\Contracts\Schedule; | |
| 6 | ||
| 7 | use Stewart\Contracts\Time\Duration; | |
| 8 | use Stewart\Contracts\Time\Instant; | |
| 9 | ||
| 10 | final readonly class ScheduledRun | |
| 11 | { | |
| 12 | public function __construct( | |
| 13 | public ScheduledTask $task, | |
| 14 | public Instant $scheduledFor, | |
| 15 | public Instant $firedAt, | |
| 16 | public int $missedOccurrences, | |
| 17 | ) {} | |
| 18 | ||
| 19 | public function getLateness(): Duration | |
| 20 | { | |
| 21 | return $this->firedAt->elapsedSince($this->scheduledFor); | |
| 22 | } | |
| 23 | } |