| Total Complexity | 9 |
| Total Lines | 56 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php declare(strict_types=1); |
||
| 13 | final class TestClock implements RewindableClock |
||
| 14 | { |
||
| 15 | /** @var RewindableClock */ |
||
| 16 | private $clock; |
||
| 17 | /** @var Closure|null */ |
||
| 18 | private $method; |
||
| 19 | |||
| 20 | private function __construct(RewindableClock $clock) |
||
| 21 | { |
||
| 22 | $this->clock = $clock; |
||
| 23 | } |
||
| 24 | |||
| 25 | public static function make(): self |
||
| 26 | { |
||
| 27 | return new self(RewindableDateTimeClock::using( |
||
| 28 | UnmovingClock::standingStillAt(new DateTimeImmutable()) |
||
| 29 | )); |
||
| 30 | } |
||
| 31 | |||
| 32 | public static function from(RewindableClock $clock): self |
||
| 33 | { |
||
| 34 | return new self($clock); |
||
| 35 | } |
||
| 36 | |||
| 37 | public function eachPassingSecondApply(Closure $method): void |
||
| 38 | { |
||
| 39 | $this->method = $method; |
||
| 40 | } |
||
| 41 | |||
| 42 | public function now(): DateTimeInterface |
||
| 45 | } |
||
| 46 | |||
| 47 | public function rewind(DateInterval $interval): RewindableClock |
||
| 48 | { |
||
| 49 | $this->clock = $this->clock->rewind($interval); |
||
| 50 | return $this; |
||
| 51 | } |
||
| 52 | |||
| 53 | public function fastForward(DateInterval $interval): RewindableClock |
||
| 69 | } |
||
| 70 | } |
||
| 71 |