| Conditions | 4 |
| Paths | 4 |
| Total Lines | 16 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 30 | public function serialize(array $data) |
||
|
|
|||
| 31 | { |
||
| 32 | if (false === array_key_exists('items', $data)) { |
||
| 33 | throw new \Exception('Given data is incorrect'); |
||
| 34 | } |
||
| 35 | if (count($data['items']) > 1) { |
||
| 36 | $objects = []; |
||
| 37 | foreach ($data['items'] as $item) { |
||
| 38 | $objects[] = $this->className::fromJson($item); |
||
| 39 | } |
||
| 40 | |||
| 41 | return $objects; |
||
| 42 | } |
||
| 43 | |||
| 44 | return $this->className::fromJson($data['items'][0]); |
||
| 45 | } |
||
| 46 | |||
| 61 |
Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a
@returnannotation as described here.