Conditions | 3 |
Paths | 3 |
Total Lines | 15 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
26 | public function toResponse($request) |
||
27 | { |
||
28 | // Respond appropriately to a deleted model |
||
29 | if ($this->deleted()) { |
||
30 | return new JsonResponse(null, $this->statusCode ?? 204); |
||
31 | } |
||
32 | |||
33 | // Return the model directly if no resource is provided |
||
34 | if (empty($this->resourceClass)) { |
||
35 | return $this->model; |
||
36 | } |
||
37 | |||
38 | return (new $this->resourceClass($this->model)) |
||
39 | ->toResponse($request) |
||
40 | ->setStatusCode($this->calculateStatus()); |
||
41 | } |
||
66 |