| Conditions | 6 |
| Paths | 4 |
| Total Lines | 17 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 6.0493 |
| Changes | 0 | ||
| 1 | <?php |
||
| 35 | 50 | private static function normalizeResult($result) |
|
| 36 | { |
||
| 37 | 50 | if (!\is_array($result)) { |
|
| 38 | return $result; |
||
| 39 | } |
||
| 40 | |||
| 41 | 50 | $firstKey = \array_key_first($result); |
|
| 42 | |||
| 43 | 50 | if (null !== $firstKey && \is_object($result[$firstKey]) && $result === [$firstKey => $result[$firstKey]]) { |
|
| 44 | 41 | return $result[$firstKey]; |
|
| 45 | } |
||
| 46 | |||
| 47 | 9 | if (\count($result) > 1) { |
|
| 48 | 5 | $result = [\array_merge(...$result)]; |
|
| 49 | } |
||
| 50 | |||
| 51 | 9 | return $result[$firstKey]; |
|
| 52 | } |
||
| 54 |