| Conditions | 3 |
| Paths | 3 |
| Total Lines | 8 |
| Code Lines | 5 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 18 | public static function camelCaseToSnakeCase(string $input): string |
||
| 19 | { |
||
| 20 | preg_match_all('!([A-Z][A-Z0-9]*(?=$|[A-Z][a-z0-9])|[A-Za-z][a-z0-9]+)!', $input, $matches); |
||
| 21 | $ret = $matches[0]; |
||
| 22 | foreach ($ret as &$match) { |
||
| 23 | $match = $match == strtoupper($match) ? strtolower($match) : lcfirst($match); |
||
| 24 | } |
||
| 25 | return implode('_', $ret); |
||
| 26 | } |
||
| 28 | } |