Total Complexity | 3 |
Total Lines | 49 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
13 | class RoCollectionFactory extends CollectionFactory |
||
14 | { |
||
15 | /** |
||
16 | * Add a relationship to the resource object. |
||
17 | * |
||
18 | * @param array $relationships |
||
19 | * |
||
20 | * @return static |
||
21 | * @throws JsonApiFakerException |
||
22 | */ |
||
23 | 6 | public function appendRelationships(array $relationships) |
|
24 | { |
||
25 | 6 | return $this->each( |
|
26 | /** |
||
27 | * @param \VGirol\JsonApiFaker\Laravel\Contract\ResourceObjectContract $resFactory |
||
28 | * |
||
29 | * @return void |
||
30 | */ |
||
31 | 6 | function ($resFactory) use ($relationships) { |
|
32 | 3 | $resFactory->appendRelationships($relationships); |
|
33 | 6 | } |
|
34 | ); |
||
35 | } |
||
36 | |||
37 | /** |
||
38 | * Returns a collection of ResourceObjectContract. |
||
39 | * |
||
40 | * @param Collection $collection |
||
41 | * @param string $resourceType |
||
42 | * |
||
43 | * @return array |
||
44 | */ |
||
45 | 9 | protected function transform($collection, $resourceType): array |
|
62 | } |
||
63 | } |
||
64 |