1 | <?php |
||
13 | final class CorsMiddleware implements MiddlewareInterface |
||
14 | { |
||
15 | /** |
||
16 | * @var ResponseFactoryInterface |
||
17 | */ |
||
18 | private $responseFactory; |
||
19 | |||
20 | /** |
||
21 | * @var string[] |
||
22 | */ |
||
23 | private $allowOrigin; |
||
24 | |||
25 | /** |
||
26 | * @var string[] |
||
27 | */ |
||
28 | private $allowMethods; |
||
29 | |||
30 | /** |
||
31 | * @var string[] |
||
32 | */ |
||
33 | private $allowHeaders; |
||
34 | |||
35 | /** |
||
36 | * @var bool |
||
37 | */ |
||
38 | private $allowCredentials; |
||
39 | |||
40 | /** |
||
41 | * @var int |
||
42 | */ |
||
43 | private $maxAge; |
||
44 | |||
45 | /** |
||
46 | * @param ResponseFactoryInterface $responseFactory |
||
47 | * @param string[] $allowHeaders |
||
48 | * @param string[] $allowMethods |
||
49 | * @param string[] $allowOrigin |
||
50 | * @param bool $allowCredentials |
||
51 | * @param int $maxAge |
||
52 | */ |
||
53 | 4 | public function __construct( |
|
68 | |||
69 | /** |
||
70 | * @param ServerRequestInterface $request |
||
71 | * @param RequestHandlerInterface $handler |
||
72 | * |
||
73 | * @return ResponseInterface |
||
74 | */ |
||
75 | 4 | public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface |
|
92 | |||
93 | /** |
||
94 | * @param ServerRequestInterface $request |
||
95 | * |
||
96 | * @return string |
||
97 | */ |
||
98 | 4 | private function getAllowOrigin(ServerRequestInterface $request): string |
|
110 | } |
||
111 |