Conditions | 2 |
Paths | 1 |
Total Lines | 12 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
32 | 19 | private function _requestHandler(callable $handler, RequestInterface $request, array $options): callable |
|
33 | { |
||
34 | 19 | return function() use ($handler, $request, $options) { |
|
35 | 19 | $requestLimitGroup = $this->_requestLimitRuleset->getRequestLimitGroup(); |
|
36 | 19 | if (!$requestLimitGroup->canRequest($request, $options)) { |
|
37 | 18 | throw new TooManyRequestsHttpException( |
|
38 | 18 | $requestLimitGroup->getRetryAfter(), |
|
39 | 18 | 'The rate limit was exceeded. Please try again later.' |
|
40 | ); |
||
41 | } |
||
42 | |||
43 | 15 | return $handler($request, $options); |
|
44 | 19 | }; |
|
47 |