| Total Complexity | 8 |
| Total Lines | 53 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 4 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 12 | class TestClock implements Clock |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * @private |
||
| 16 | */ |
||
| 17 | const FORMAT_OF_TIME = 'Y-m-d H:i:s.uO'; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * @var DateTimeImmutable |
||
| 21 | */ |
||
| 22 | private $time; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * @var DateTimeZone |
||
| 26 | */ |
||
| 27 | private $timeZone; |
||
| 28 | |||
| 29 | public function __construct(DateTimeZone $timeZone = null) |
||
| 33 | 27 | } |
|
| 34 | 27 | ||
| 35 | public function tick(): void |
||
| 36 | 27 | { |
|
| 37 | $this->time = new DateTimeImmutable('now', $this->timeZone); |
||
| 38 | 27 | } |
|
| 39 | 27 | ||
| 40 | public function fixate(string $input): void |
||
| 50 | 2 | } |
|
| 51 | 2 | ||
| 52 | public function moveForward(DateInterval $interval): void |
||
| 53 | 1 | { |
|
| 54 | $this->time = $this->now()->add($interval); |
||
| 55 | 1 | } |
|
| 56 | 1 | ||
| 57 | public function now(): DateTimeImmutable |
||
| 58 | 10 | { |
|
| 59 | return $this->time; |
||
| 60 | 10 | } |
|
| 61 | |||
| 62 | public function timeZone(): DateTimeZone |
||
| 65 | 6 | } |
|
| 66 | } |
||
| 67 |