1 | <?php |
||
12 | final class RateLimitMiddleware implements MiddlewareInterface |
||
13 | { |
||
14 | /** |
||
15 | * @var ClientExtractorInterface |
||
16 | */ |
||
17 | private $clientExtractor; |
||
18 | |||
19 | /** |
||
20 | * @var LimitedResponseFactoryInterface |
||
21 | */ |
||
22 | private $responseFactory; |
||
23 | |||
24 | /** |
||
25 | * Create a new instance of the middleware. |
||
26 | * |
||
27 | * @param ClientExtractorInterface $clientExtractor Obtains the client from the HTTP request. |
||
28 | * @param LimitedResponseFactoryInterface $responseFactory Factory object for creating 429 responses. |
||
29 | */ |
||
30 | public function __construct( |
||
37 | |||
38 | /** |
||
39 | * Execute this middleware. |
||
40 | * |
||
41 | * @param ServerRequestInterface $request The PSR7 request. |
||
42 | * @param ResponseInterface $response The PSR7 response. |
||
43 | * @param callable $next The Next middleware. |
||
44 | * |
||
45 | * @return ResponseInterface |
||
46 | */ |
||
47 | public function __invoke(ServerRequestInterface $request, ResponseInterface $response, callable $next) |
||
56 | } |
||
57 |