| Conditions | 2 |
| Paths | 2 |
| Total Lines | 14 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 38 | 3 | public function execute($command, callable $next) |
|
| 39 | { |
||
| 40 | 3 | $rateLimit = $this->rateLimitProvider->provide($command); |
|
| 41 | |||
| 42 | 3 | if (null !== $rateLimit) { |
|
| 43 | 2 | $this->logger->info('Throttling command with key {key} for {limit} on {time} ms', [ |
|
| 44 | 2 | 'key' => $rateLimit->getKey(), |
|
| 45 | 2 | 'limit' => $rateLimit->getLimit(), |
|
| 46 | 2 | 'time' => $rateLimit->getMilliseconds(), |
|
| 47 | ]); |
||
| 48 | 2 | $this->rateLimiter->throttle($rateLimit); |
|
| 49 | } |
||
| 50 | |||
| 51 | 3 | return $next($command); |
|
| 52 | } |
||
| 54 |