Conditions | 2 |
Paths | 1 |
Total Lines | 17 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 2 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
45 | 9 | protected function transform($collection, $resourceType): array |
|
46 | { |
||
47 | 9 | return $collection->map( |
|
48 | /** |
||
49 | * @param Model $model |
||
50 | * |
||
51 | * @return \VGirol\JsonApiFaker\Laravel\Contract\ResourceObjectContract |
||
52 | * @throws JsonApiFakerException |
||
53 | */ |
||
54 | 9 | function ($model) use ($resourceType) { |
|
55 | 9 | if (!is_a($model, Model::class)) { |
|
56 | 3 | throw new JsonApiFakerException(Messages::ERROR_NOT_MODEL_INSTANCE); |
|
57 | } |
||
58 | |||
59 | 6 | return $this->generator->resourceObject($model, $resourceType); |
|
60 | 9 | } |
|
61 | 6 | )->toArray(); |
|
62 | } |
||
64 |