| Total Complexity | 4 |
| Total Lines | 36 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | final class TimerBuilder implements ITimerBuilder |
||
| 15 | { |
||
| 16 | private ?float $startingTime = null; |
||
| 17 | private ?Closure $timeFunction = null; |
||
| 18 | |||
| 19 | public function build(): ITimer |
||
| 20 | { |
||
| 21 | $this->validate(); |
||
| 22 | |||
| 23 | return new Timer( |
||
| 24 | timeFunction: $this->timeFunction, |
||
|
|
|||
| 25 | time: $this->startingTime, |
||
| 26 | ); |
||
| 27 | } |
||
| 28 | |||
| 29 | private function validate(): void |
||
| 35 | }; |
||
| 36 | } |
||
| 37 | |||
| 38 | public function withStartTime(float $time): ITimerBuilder |
||
| 43 | } |
||
| 44 | |||
| 45 | public function withTimeFunction(Closure $timeFunction): ITimerBuilder |
||
| 52 |