Conditions | 3 |
Paths | 3 |
Total Lines | 8 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 3 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
35 | 36 | protected function fromCamelCase($input) |
|
36 | { |
||
37 | 36 | preg_match_all('!([A-Z][A-Z0-9]*(?=$|[A-Z][a-z0-9])|[A-Za-z][a-z0-9]+)!', $input, $matches); |
|
38 | 36 | $ret = $matches[0]; |
|
39 | 36 | foreach ($ret as &$match) { |
|
40 | 36 | $match = $match == strtoupper($match) ? strtolower($match) : lcfirst($match); |
|
41 | } |
||
42 | 36 | return implode('_', $ret); |
|
43 | } |
||
44 | } |