lithium\util\Inflector::camelize()
Takes a under_scored word and turns it into a CamelCased or camelBack word
Parameters
-
string
$word
An under_scored or slugged word (i.e.
'red_bike'
or'red-bike'
). -
boolean
$cased
If false, first character is not upper cased
Returns
stringCamelCased version of the word (i.e. 'RedBike'
).
Source
public static function camelize($word, $cased = true) {
$_word = $word;
if (isset(static::$_camelized[$_word]) && $cased) {
return static::$_camelized[$_word];
}
$word = str_replace(" ", "", ucwords(str_replace(["_", '-'], " ", $word)));
if (!$cased) {
return lcfirst($word);
}
return static::$_camelized[$_word] = $word;
}