| Conditions | 3 |
| Paths | 3 |
| Total Lines | 11 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 0 | ||
| 1 | <?php |
||
| 27 | protected function camelCaseToUnderscore(string $input) : string |
||
| 28 | { |
||
| 29 | preg_match_all('/([A-Z][A-Z0-9]*(?=$|[A-Z][a-z0-9])|[A-Za-z][a-z0-9]+)/', $input, $matches); |
||
| 30 | $output = $matches[0]; |
||
| 31 | |||
| 32 | foreach ($output as &$match) { |
||
| 33 | $match = $match == strtoupper($match) ? strtolower($match) : lcfirst($match); |
||
| 34 | } |
||
| 35 | |||
| 36 | return implode('_', $output); |
||
| 37 | } |
||
| 38 | } |
||
| 39 |