| 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 |
||
| 27 | 5 | private function wrapInResource($value) |
|
| 28 | { |
||
| 29 | 5 | if (!$this->resource) { |
|
| 30 | 1 | throw new Exception("You must first set a resource class"); |
|
| 31 | } |
||
| 32 | |||
| 33 | 4 | if ($value instanceof Model) { |
|
| 34 | 1 | $resource_class = $this->resource; |
|
| 35 | 1 | return $resource_class::make($value); |
|
| 36 | } |
||
| 37 | |||
| 38 | 3 | if ($this->resource_collection) { |
|
| 39 | 1 | $resource_class = $this->resource_collection; |
|
| 40 | 1 | return $resource_class::make($value); |
|
| 41 | } |
||
| 42 | |||
| 43 | 2 | $resource_class = $this->resource; |
|
| 44 | |||
| 45 | 2 | return $resource_class::collection($value); |
|
| 46 | } |
||
| 48 |