| Total Complexity | 7 |
| Total Lines | 40 |
| Duplicated Lines | 0 % |
| Coverage | 94.44% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 9 | trait ConvertsIdToKey |
||
| 10 | { |
||
| 11 | 161 | protected function convertIdToKey(array|string $data): array|string |
|
| 12 | { |
||
| 13 | 161 | if (is_string($data)) { |
|
|
|
|||
| 14 | 120 | return $this->convertIdInString($data); |
|
| 15 | } |
||
| 16 | |||
| 17 | 137 | if (! Arr::isAssoc($data)) { |
|
| 18 | return $data; |
||
| 19 | } |
||
| 20 | |||
| 21 | 137 | return $this->convertIdInArrayKeys($data); |
|
| 22 | } |
||
| 23 | |||
| 24 | 161 | protected function convertIdInString(string $data): string |
|
| 31 | ); |
||
| 32 | } |
||
| 33 | |||
| 34 | /** |
||
| 35 | * @param array<mixed> $data |
||
| 36 | * @return array<mixed> |
||
| 37 | */ |
||
| 38 | 137 | protected function convertIdInArrayKeys(array $data): array |
|
| 51 |