| Total Complexity | 5 |
| Total Lines | 26 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 6 | class KeysToCamelCaseWalker implements ResultWalker |
||
| 7 | { |
||
| 8 | 1 | public function walk(array $result): array |
|
| 9 | { |
||
| 10 | 1 | $camelCased = []; |
|
| 11 | |||
| 12 | 1 | array_walk($result, function ($value, $key) use (&$camelCased) { |
|
| 13 | 1 | $key = is_string($key) ? $this->toCamelCase($key) : $key; |
|
| 14 | |||
| 15 | 1 | if (is_array($value)) { |
|
| 16 | 1 | $camelCased[$key] = $this->walk($value); |
|
| 17 | } else { |
||
| 18 | 1 | $camelCased[$key] = $value; |
|
| 19 | } |
||
| 20 | 1 | }, array_keys($result)); |
|
| 21 | |||
| 22 | 1 | return $camelCased; |
|
| 23 | } |
||
| 24 | |||
| 25 | private function toCamelCase(string $value): string |
||
| 32 | } |
||
| 33 | } |
||
| 34 |