Conditions | 2 |
Paths | 2 |
Total Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
30 | 2 | public function process(ServerRequestInterface $req, RequestHandlerInterface $handler): ResponseInterface |
|
31 | { |
||
32 | 2 | $methods = $req->getAttribute(MethodMiddleware::class); |
|
33 | |||
34 | 2 | if (is_array($methods)) |
|
35 | { |
||
36 | 1 | $res = $this->factory->createResponse(405)->withHeader('Allow', implode(',', $methods)); |
|
37 | |||
38 | 1 | $res->getBody()->write($this->renderer->render($this->template, ['method' => $req->getMethod()])); |
|
39 | |||
40 | 1 | return $res; |
|
41 | } |
||
42 | |||
43 | 1 | return $handler->handle($req); |
|
44 | } |
||
45 | } |