| Conditions | 3 |
| Paths | 4 |
| Total Lines | 19 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 30 | 4 | public static function deserializeList(string $objectClass, $serializedObjectList = null) |
|
| 31 | { |
||
| 32 | 4 | if ($serializedObjectList instanceof \Iterator) { |
|
| 33 | 1 | $serializedObjectList = iterator_to_array($serializedObjectList); |
|
| 34 | } |
||
| 35 | |||
| 36 | 4 | if (!$serializedObjectList) { |
|
| 37 | 3 | return []; |
|
| 38 | } |
||
| 39 | |||
| 40 | 1 | $serializedObjectList = array_filter($serializedObjectList, function ($objectArray) use ($serializedObjectList) { |
|
| 41 | 1 | return $objectArray; |
|
| 42 | 1 | }); |
|
| 43 | |||
| 44 | 1 | return array_map(function ($objectArray) use ($objectClass) { |
|
| 45 | |||
| 46 | 1 | return call_user_func([$objectClass, 'deserialize'], $objectArray); |
|
| 47 | 1 | }, $serializedObjectList); |
|
| 48 | } |
||
| 49 | } |