| Conditions | 3 |
| Paths | 3 |
| Total Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 23 | 6 | public function waitForThrottle() { |
|
| 24 | 6 | if (!$this->lastTime) { |
|
| 25 | 3 | $this->lastTime = \microtime(true); |
|
| 26 | 3 | return; |
|
| 27 | } |
||
| 28 | |||
| 29 | 5 | $diff = $this->interval - (\microtime(true) - $this->lastTime); |
|
| 30 | |||
| 31 | 5 | if ($diff > 0) { |
|
| 32 | 1 | usleep((int)ceil($diff * 1000 * 1000)); |
|
| 33 | } |
||
| 34 | |||
| 35 | 5 | $this->lastTime = \microtime(true); |
|
| 36 | 5 | } |
|
| 37 | |||
| 48 |