1 | <?php |
||
11 | final class OptionsMiddleware implements RequestMethodInterface |
||
12 | { |
||
13 | /** |
||
14 | * @var string |
||
15 | */ |
||
16 | private $origin; |
||
17 | |||
18 | /** |
||
19 | * @var string[] |
||
20 | */ |
||
21 | private $headers; |
||
22 | |||
23 | /** |
||
24 | * Create a new instance of OptionsMiddleware. |
||
25 | * |
||
26 | * @param string $origin Value for the Access-Control-Allow-Origin header. |
||
27 | * @param string[] $headers Value for the Access-Control-Allow-Headers header. |
||
28 | */ |
||
29 | public function __construct(string $origin, array $headers) |
||
34 | |||
35 | /** |
||
36 | * Invoke this middleware. |
||
37 | * |
||
38 | * @param ServerRequestInterface $request The incoming HTTP request. |
||
39 | * @param ResponseInterface $response The outgoing HTTP response. |
||
40 | * @param callable $next The next middleware in the stack. |
||
41 | * |
||
42 | * @return ResponseInterface |
||
43 | * |
||
44 | * @throws NotFoundException |
||
45 | */ |
||
46 | public function __invoke(ServerRequestInterface $request, ResponseInterface $response, callable $next) : ResponseInterface |
||
63 | } |
||
64 |