1 | <?php |
||
12 | class AcceptMethods |
||
13 | { |
||
14 | use RequestAttributesTrait; |
||
15 | |||
16 | /** |
||
17 | * HTTP methods allowed to bypass CSRF protection. |
||
18 | * |
||
19 | * @var string[] |
||
20 | */ |
||
21 | protected $methods; |
||
22 | |||
23 | /** |
||
24 | * Create new AcceptMethods middleware. |
||
25 | * |
||
26 | * @param string[] $methods HTTP methods allowed to bypass CSRF protection |
||
27 | */ |
||
28 | public function __construct(array $methods = array('GET', 'OPTIONS')) |
||
32 | |||
33 | /** |
||
34 | * Invoke middleware. |
||
35 | * |
||
36 | * @param ServerRequestInterface $request request object |
||
37 | * @param ResponseInterface $response response object |
||
38 | * @param callable $next next middleware |
||
39 | * |
||
40 | * @return ResponseInterface response object |
||
41 | */ |
||
42 | public function __invoke(ServerRequestInterface $request, ResponseInterface $response, callable $next) |
||
50 | } |
||
51 |