mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-18 18:46:17 +00:00
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:
parent
846af89259
commit
1634eefce5
1 changed files with 12 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue