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