Lines
100.00%
5 / 5
Methods
100.00%
5 / 5
Classes
100.00%
1 / 1
| Name | Lines | Methods | CRAP | ||||
|---|---|---|---|---|---|---|---|
| __construct | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| fromMoment | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| findNextOccurrenceAfter | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 2 | ||
| describe | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| isRecurring | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| 10 | final readonly class OneShotSchedule implements WallClockSchedule | |
| 11 | { | |
| 12 | private function __construct(public DateTimeImmutable $moment) {} | |
| 13 | ||
| 14 | public static function fromMoment(DateTimeImmutable $moment): self | |
| 15 | { | |
| 16 | return new self($moment); | |
| 17 | } | |
| 18 | ||
| 19 | public function findNextOccurrenceAfter(DateTimeImmutable $after): ?DateTimeImmutable | |
| 20 | { | |
| 21 | return $this->moment > $after ? $this->moment->setTimezone($after->getTimezone()) : null; | |
| 22 | } | |
| 23 | ||
| 24 | public function describe(): string | |
| 25 | { | |
| 26 | return \sprintf('once at %s', $this->moment->format('c')); | |
| 27 | } | |
| 28 | ||
| 29 | public function isRecurring(): bool | |
| 30 | { | |
| 31 | return false; | |
| 32 | } | |
| 33 | } |