Total Complexity | 4 |
Total Lines | 32 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
13 | class ResourceIdentifierFactory extends BaseFactory implements ResourceIdentifierContract |
||
14 | { |
||
15 | 1 | use HasIdentification; |
|
16 | 1 | use HasMeta; |
|
17 | |||
18 | /** |
||
19 | * @return array |
||
20 | */ |
||
21 | 48 | public function toArray(): array |
|
22 | { |
||
23 | 48 | $resource = []; |
|
24 | 48 | $identification = $this->getIdentification(); |
|
25 | 48 | if ($identification !== null) { |
|
26 | 42 | $resource = $identification; |
|
27 | } |
||
28 | |||
29 | 48 | if (isset($this->meta)) { |
|
30 | 30 | $resource[Members::META] = $this->meta; |
|
31 | } |
||
32 | |||
33 | 48 | return $resource; |
|
34 | } |
||
35 | |||
36 | /** |
||
37 | * Fill the resource identifier object with fake values ("type", "id" and "meta"). |
||
38 | * |
||
39 | * @return static |
||
40 | */ |
||
41 | 36 | public function fake() |
|
45 | } |
||
46 | } |
||
47 |