| Conditions | 4 |
| Paths | 5 |
| Total Lines | 15 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 43 | 2 | private function fixValues(array $rawData): array |
|
| 44 | { |
||
| 45 | 2 | $data = []; |
|
| 46 | 2 | foreach ($rawData as $rawKey => $value) { |
|
| 47 | 2 | $key = (string) (int) $rawKey === $rawData ? (int) $rawKey : $rawKey; |
|
| 48 | |||
| 49 | 2 | if (is_array($value)) { |
|
| 50 | 2 | $data[$key] = $this->fixValues($value); |
|
| 51 | } else { |
||
| 52 | 2 | $data[$key] = $this->fixValue($value); |
|
| 53 | } |
||
| 54 | } |
||
| 55 | |||
| 56 | 2 | return $data; |
|
| 57 | } |
||
| 58 | |||
| 89 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.