| Conditions | 4 |
| Paths | 6 |
| Total Lines | 16 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 4.128 |
| Changes | 0 | ||
| 1 | <?php |
||
| 35 | private function convertToSnake(iterable &$array): void |
||
| 36 | { |
||
| 37 | 1 | if ($array instanceof Traversable) { |
|
| 38 | $array = iterator_to_array($array); |
||
| 39 | } |
||
| 40 | |||
| 41 | 1 | foreach (array_keys($array) as $key) { |
|
|
|
|||
| 42 | 1 | $value = &$array[$key]; |
|
| 43 | 1 | unset($array[$key]); |
|
| 44 | |||
| 45 | 1 | $transformedKey = Strings::toSnakeCase($key); |
|
| 46 | 1 | if (is_iterable($value)) { |
|
| 47 | $this->convertToSnake($value); |
||
| 48 | } |
||
| 49 | 1 | $array[$transformedKey] = $value; |
|
| 50 | 1 | unset($value); |
|
| 51 | } |
||
| 54 |