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