Conditions | 4 |
Paths | 4 |
Total Lines | 19 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 4 |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
22 | 5 | private function wrapInResource($value) |
|
23 | { |
||
24 | 5 | if (!$this->resource) { |
|
25 | 1 | throw new Exception("You must first set a resource class"); |
|
26 | } |
||
27 | |||
28 | 4 | if ($value instanceof Model) { |
|
29 | 1 | $resource_class = $this->resource; |
|
30 | 1 | return $resource_class::make($value); |
|
31 | } |
||
32 | |||
33 | 3 | if ($this->resource_collection) { |
|
34 | 1 | $resource_class = $this->resource_collection; |
|
35 | 1 | return $resource_class::make($value); |
|
36 | } |
||
37 | |||
38 | 2 | $resource_class = $this->resource; |
|
39 | |||
40 | 2 | return $resource_class::collection($value); |
|
41 | } |
||
43 |