Conditions | 3 |
Paths | 4 |
Total Lines | 13 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
14 | 3 | public static function toCamelCase($parametri = array()) |
|
15 | { |
||
16 | 3 | $str = $parametri['str']; |
|
17 | 3 | $capitalise_first_char = isset($parametri['primamaiuscola']) ? $parametri['primamaiuscola'] : false; |
|
18 | |||
19 | 3 | if ($capitalise_first_char) { |
|
20 | 3 | $str[0] = strtoupper($str[0]); |
|
21 | } |
||
22 | $func = function ($matches) { |
||
23 | 2 | return strtoupper($matches[1]); |
|
24 | 3 | }; |
|
25 | |||
26 | 3 | return preg_replace_callback('/_([a-z])/', $func, $str); |
|
27 | } |
||
58 |