| Total Complexity | 4 |
| Total Lines | 36 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 16 | final class DeltaTimerBuilder implements IDeltaTimerBuilder |
||
| 17 | { |
||
| 18 | private ?float $startTime = null; |
||
| 19 | private ?INowTimer $nowTimer = null; |
||
| 20 | |||
| 21 | public function build(): IDeltaTimer |
||
| 28 | ); |
||
| 29 | } |
||
| 30 | |||
| 31 | private function validate(): void |
||
| 32 | { |
||
| 33 | match (true) { |
||
| 34 | $this->startTime === null => throw new LogicException('Start time is not set.'), |
||
| 35 | $this->nowTimer === null => throw new LogicException('NowTimer is not set.'), |
||
| 36 | default => null, |
||
| 37 | }; |
||
| 38 | } |
||
| 39 | |||
| 40 | public function withStartTime(float $time): IDeltaTimerBuilder |
||
| 41 | { |
||
| 42 | $clone = clone $this; |
||
| 43 | $clone->startTime = $time; |
||
| 44 | return $clone; |
||
| 45 | } |
||
| 46 | |||
| 47 | public function withNowTimer(INowTimer $now): IDeltaTimerBuilder |
||
| 52 | } |
||
| 53 | } |
||
| 54 |