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