| Total Complexity | 8 |
| Total Lines | 43 |
| Duplicated Lines | 0 % |
| Coverage | 90.91% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 9 | trait ConvertsIdToKey |
||
| 10 | { |
||
| 11 | 140 | protected function convertIdToKey(array|string $data): array|string |
|
| 22 | } |
||
| 23 | |||
| 24 | 140 | protected function convertIdInString(string $data): string |
|
| 25 | { |
||
| 26 | 140 | return preg_replace( |
|
| 27 | 140 | "/(?<![_a-zA-Z0-9_\s\.][^\.])id$/", |
|
| 28 | 140 | '_key', |
|
| 29 | 140 | $data, |
|
| 30 | 140 | 1 |
|
| 31 | 140 | ); |
|
| 32 | } |
||
| 33 | |||
| 34 | /** |
||
| 35 | * @param array<mixed> $data |
||
| 36 | * @return array<mixed> |
||
| 37 | */ |
||
| 38 | 29 | protected function convertIdInArrayKeys(array $data): array |
|
| 52 | } |
||
| 53 | } |
||
| 54 |