Conditions | 2 |
Paths | 1 |
Total Lines | 15 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
34 | public function handle() : callable |
||
35 | { |
||
36 | return function(callable $handler) : callable |
||
37 | { |
||
38 | 1 | return function(RequestInterface $request, array $options) use ($handler) |
|
39 | { |
||
40 | 1 | if (!$this->_requestLimitGroup->canRequest()) |
|
41 | { |
||
42 | 1 | throw new TooManyRequestsHttpException( |
|
43 | 1 | $this->_requestLimitGroup->getRetryAfter(), |
|
44 | 1 | 'The rate limit was exceeded. Please try again later.' |
|
45 | ); |
||
46 | } |
||
47 | |||
48 | 1 | return $handler($request, $options); |
|
49 | 1 | }; |
|
52 | } |