Conditions | 1 |
Paths | 1 |
Total Lines | 16 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
15 | public function textToCamelCase ( string $word ) : string |
||
16 | { |
||
17 | // Make an array of word parts exploding the word by "_" |
||
18 | $wordParts = explode( "_", $word ); |
||
19 | |||
20 | // Make every word part lower case |
||
21 | $wordParts = array_map( "strtolower", $wordParts ); |
||
22 | |||
23 | // Make every word part first character uppercase |
||
24 | $wordParts = array_map( "ucfirst", $wordParts ); |
||
25 | |||
26 | // Make the new word the combination of the given word parts |
||
27 | $newWord = implode( "", $wordParts ); |
||
28 | |||
29 | // Make the new word first character lowercase |
||
30 | return lcfirst( $newWord ); |
||
31 | } |
||
52 |