| 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 |
||
| 23 | 21 | protected function transform($collection, $resourceType): array |
|
| 24 | { |
||
| 25 | 21 | return $collection->map( |
|
| 26 | /** |
||
| 27 | * @param \Illuminate\Database\Eloquent\Model $model |
||
| 28 | * |
||
| 29 | * @return \VGirol\JsonApiFaker\Laravel\Contract\ResourceIdentifierContract |
||
| 30 | * @throws JsonApiFakerException |
||
| 31 | */ |
||
| 32 | 21 | function ($model) use ($resourceType) { |
|
| 33 | 21 | if (!is_a($model, Model::class)) { |
|
| 34 | 3 | throw new JsonApiFakerException(Messages::ERROR_NOT_MODEL_INSTANCE); |
|
| 35 | } |
||
| 36 | |||
| 37 | 18 | return $this->generator->resourceIdentifier($model, $resourceType); |
|
| 38 | 21 | } |
|
| 39 | 18 | )->toArray(); |
|
| 40 | } |
||
| 42 |