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