Adding Inflector::variable() to create camelBacked version of a string

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@3766 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
phpnut 2006-10-31 03:14:26 +00:00
parent 846af89259
commit 1634eefce5

View file

@ -379,6 +379,18 @@ class Inflector extends Object {
$replace = Inflector::camelize(Inflector::singularize($tableName));
return $replace;
}
/**
* Returns camelBacked version of a string.
*
* @param string $string
* @return string
*/
function variable($string) {
$string = Inflector::camelize(Inflector::underscore($string));
$replace = strtolower(substr($string, 0, 1));
$variable = preg_replace('/\\w/', $replace, $string, 1);
return $variable;
}
}
/**