1 | <?php declare(strict_types=1); |
||
14 | final class RateLimitStateMiddleware implements MiddlewareInterface |
||
15 | { |
||
16 | use DefaultPriorityTrait; |
||
17 | use PreTrait; |
||
18 | use ErrorTrait; |
||
19 | |||
20 | const HEADERS = [ |
||
21 | 'X-RateLimit-Limit' => 'setLimit', |
||
22 | 'X-RateLimit-Remaining' => 'setRemaining', |
||
23 | 'X-RateLimit-Reset' => 'setReset', |
||
24 | ]; |
||
25 | |||
26 | /** |
||
27 | * @var RateLimitState |
||
28 | */ |
||
29 | private $state; |
||
30 | |||
31 | /** |
||
32 | * RateLimitStatusMiddleware constructor. |
||
33 | * @param RateLimitState $state |
||
34 | */ |
||
35 | 1 | public function __construct(RateLimitState $state) |
|
39 | |||
40 | /** |
||
41 | * @param ResponseInterface $response |
||
42 | * @param array $options |
||
43 | * @return CancellablePromiseInterface |
||
44 | */ |
||
45 | 1 | public function post(ResponseInterface $response, array $options = []): CancellablePromiseInterface |
|
57 | } |
||
58 |