Conditions | 3 |
Paths | 3 |
Total Lines | 27 |
Code Lines | 21 |
Lines | 0 |
Ratio | 0 % |
Tests | 21 |
CRAP Score | 3 |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
47 | public function jsonSerialize(): array |
||
48 | 3 | { |
|
49 | $userValues = []; |
||
50 | 3 | ||
51 | 2 | if ($this->item instanceof JsonSerializable) { |
|
52 | 2 | $userSerialisation = $this->item->jsonSerialize(); |
|
|
|||
53 | 1 | if (is_iterable($userSerialisation)) { |
|
54 | $userValues = $userSerialisation; |
||
55 | 1 | } else { |
|
56 | $userValues = ['extra' => $userSerialisation]; |
||
57 | } |
||
58 | } |
||
59 | 3 | ||
60 | 3 | return [ |
|
61 | 3 | 'x' => $this->x, |
|
62 | 3 | 'y' => $this->y, |
|
63 | 3 | 'z' => $this->z, |
|
64 | 3 | 'width' => $this->width, |
|
65 | 3 | 'length' => $this->length, |
|
66 | 3 | 'depth' => $this->depth, |
|
67 | 3 | 'item' => [ |
|
68 | 3 | ...$userValues, |
|
69 | 3 | 'description' => $this->item->getDescription(), |
|
70 | 3 | 'width' => $this->item->getWidth(), |
|
71 | 3 | 'length' => $this->item->getLength(), |
|
72 | 3 | 'depth' => $this->item->getDepth(), |
|
73 | 3 | 'allowedRotation' => $this->item->getAllowedRotation(), |
|
74 | 3 | ], |
|
78 |