Total Complexity | 4 |
Total Lines | 38 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
5 | class Str |
||
6 | { |
||
7 | /** |
||
8 | * Converts string to camel case. |
||
9 | * |
||
10 | * @link https://en.wikipedia.org/wiki/CamelCase |
||
11 | * |
||
12 | * @param string $str |
||
13 | * @return string |
||
14 | */ |
||
15 | public static function toCamelCase($str) |
||
16 | { |
||
17 | return str_replace( |
||
18 | ' ', |
||
19 | '', |
||
20 | ucwords(str_replace(array('-', '_'), ' ', $str)) |
||
21 | ); |
||
22 | } |
||
23 | |||
24 | /** |
||
25 | * Converts string to snake case. |
||
26 | * |
||
27 | * @link https://en.wikipedia.org/wiki/Snake_case |
||
28 | * |
||
29 | * @param string $str |
||
30 | * @param string $delimiter |
||
31 | * @return string |
||
32 | */ |
||
33 | public static function toSnakeCase($str, $delimiter = '_') |
||
43 | } |
||
44 | } |
||
45 |