| Conditions | 1 |
| Paths | 1 |
| Total Lines | 20 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 13 | public function __invoke(ContainerInterface $container): CorsMiddleware |
||
| 14 | { |
||
| 15 | $problemDetailsResponseFactory = $container->get(ProblemDetailsResponseFactory::class); |
||
| 16 | |||
| 17 | return new CorsMiddleware([ |
||
| 18 | 'origin' => ['*'], |
||
| 19 | 'methods' => ['GET', 'POST', 'PUT', 'PATCH', 'DELETE'], |
||
| 20 | 'headers.allow' => ['Authorization', 'If-Match', 'If-Unmodified-Since', 'Content-Type'], |
||
| 21 | 'headers.expose' => ['Etag'], |
||
| 22 | 'credentials' => true, |
||
| 23 | 'cache' => 0, |
||
| 24 | 'error' => function ($request, $response, $arguments) use ($problemDetailsResponseFactory) { |
||
| 25 | //return $this->error($request, $response, $arguments); |
||
| 26 | return $problemDetailsResponseFactory->createResponse( |
||
| 27 | $request, |
||
| 28 | 401, |
||
| 29 | '', |
||
| 30 | $arguments['message'], |
||
| 31 | '', |
||
| 32 | [] |
||
| 33 | ); |
||
| 38 |