| Conditions | 4 |
| Paths | 6 |
| Total Lines | 16 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 37 | private function normalizeArray(array $mapping): array |
||
| 38 | { |
||
| 39 | $type = $mapping['type']; |
||
| 40 | $target = ['type' => Strings::camelToSnake($type)]; |
||
| 41 | foreach (TypeEnum::getParameters($type) as $parameter) { |
||
| 42 | if (isset($mapping[$parameter])) { |
||
| 43 | $target[Strings::camelToSnake($parameter)] = $mapping[$parameter]; |
||
| 44 | } |
||
| 45 | } |
||
| 46 | $key = 'properties'; |
||
| 47 | if (!empty($target[$key])) { |
||
| 48 | $target[$key] = array_map([$this, 'normalizeArray'], $target[$key]); |
||
| 49 | } else { |
||
| 50 | unset($target[$key]); |
||
| 51 | } |
||
| 52 | return $target; |
||
| 53 | } |
||
| 55 |