Conditions | 8 |
Paths | 96 |
Total Lines | 24 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 3 |
CRAP Score | 8 |
Changes | 0 |
1 | <?php |
||
25 | public function toArray(): array |
||
26 | { |
||
27 | $json = []; |
||
28 | |||
29 | if (isset($this->meta)) { |
||
30 | $json[Members::META] = $this->meta; |
||
31 | } |
||
32 | if (isset($this->links)) { |
||
33 | $json[Members::LINKS] = $this->links; |
||
34 | } |
||
35 | if (isset($this->errors)) { |
||
36 | $json[Members::ERRORS] = $this->errors; |
||
37 | } |
||
38 | if ($this->dataHasBeenSet()) { |
||
39 | $json[Members::DATA] = is_null($this->data) ? null : $this->data->toArray(); |
||
40 | 2 | } |
|
41 | if (isset($this->included)) { |
||
42 | 2 | $json[Members::INCLUDED] = $this->included->toArray(); |
|
43 | } |
||
44 | 2 | if (isset($this->jsonapi)) { |
|
45 | $json[Members::JSONAPI] = $this->jsonapi->toArray(); |
||
46 | } |
||
47 | |||
48 | return $json; |
||
49 | } |
||
73 |