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