Conditions | 3 |
Paths | 3 |
Total Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
36 | public static function decamelize(string $input): string |
||
37 | { |
||
38 | preg_match_all('!([A-Z][A-Z0-9]*(?=$|[A-Z][a-z0-9])|[A-Za-z][a-z0-9]+)!', $input, $matches); |
||
39 | $result = $matches[0]; |
||
40 | foreach ($result as &$match) { |
||
41 | $match = $match === strtoupper($match) ? strtolower($match) : lcfirst($match); |
||
42 | } |
||
43 | return implode('-', $result); |
||
44 | } |
||
45 | |||
47 |