Conditions | 3 |
Paths | 3 |
Total Lines | 19 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
18 | public function __invoke(AbstractRequest $request, InvokerInterface $invoker): ResourceObject |
||
19 | { |
||
20 | if ($request->method === Request::OPTIONS) { |
||
21 | $ro = $request->resourceObject; |
||
22 | $ro->view = $this->optionsRenderer->render($request->resourceObject); |
||
23 | |||
24 | return $ro; |
||
25 | } |
||
26 | |||
27 | if ($request->method === Request::HEAD) { |
||
28 | $getRequest = clone $request; |
||
29 | $getRequest->method = 'get'; |
||
30 | $ro = $invoker->invoke($getRequest); |
||
31 | $ro->body = null; |
||
32 | |||
33 | return $ro; |
||
34 | } |
||
35 | |||
36 | throw new MethodNotAllowedException($request->resourceObject::class . "::{({$request->method}}()", 405); |
||
37 | } |
||
39 |