| Conditions | 2 |
| Paths | 2 |
| Total Lines | 17 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 30 | 1 | public function throttle(RateLimit $rateLimit): void |
|
| 31 | { |
||
| 32 | 1 | $estimation = $this->throttle->getEstimate( |
|
| 33 | 1 | $rateLimit->getKey(), |
|
| 34 | 1 | $rateLimit->getLimit(), |
|
| 35 | 1 | $rateLimit->getMilliseconds() |
|
| 36 | ); |
||
| 37 | |||
| 38 | 1 | $this->throttle->throttle( |
|
| 39 | 1 | $rateLimit->getKey(), |
|
| 40 | 1 | $rateLimit->getLimit(), |
|
| 41 | 1 | $rateLimit->getMilliseconds() |
|
| 42 | ); |
||
| 43 | |||
| 44 | 1 | if ($estimation > 0) { |
|
| 45 | 1 | $this->logger->info('Rate limiter throttled execution for {time} ms', [ |
|
| 46 | 1 | 'time' => $estimation, |
|
| 47 | ]); |
||
| 51 |