Conditions | 2 |
Paths | 2 |
Total Lines | 6 |
Code Lines | 4 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
29 | public function throwOnTimeout(?float $currentTime = null, string $message = 'Exceeded the timeout'): void |
||
30 | { |
||
31 | $spentTime = ($currentTime ?? microtime(true)) - $this->startTime; |
||
32 | $isTimeout = $spentTime >= $this->timeout; |
||
33 | if ($isTimeout) { |
||
34 | throw new TimeoutException($message, $spentTime, $this->timeout); |
||
35 | } |
||
38 |