Pluralize and singularize English words.
Inflector pluralizes and singularizes English nouns. Used by CakePHP's naming conventions throughout the framework.
arrayMethod cache array.
arrayThe initial state of Inflector so reset() works.
arrayIrregular rules
arrayPlural inflector rules
arraySingular inflector rules
arrayWords that should not be inflected
Returns Cake model class name ("Person" for the database table "people".) for given database table.
Returns the input lower_case_delimited_string as 'A Human Readable String'.
Clears Inflectors inflected value caches. And resets the inflection rules to the initial values.
Adds custom inflection $rules, of either 'plural', 'singular', 'uninflected' or 'irregular' $type.
Returns corresponding table name for given model $className. ("people" for the model class "Person").
_cache(string $type, string $key, mixed $value)
Cache inflected values, and return if already available
string $type Inflection type
string $key Original value
string|false $value optional Inflected value
string|falseInflected value on cache hit or false on cache miss.
camelize(string $string, string $delimiter)
Returns the input lower_case_delimited_string as a CamelCasedString.
string $string String to camelize
string $delimiter optional the delimiter in the input string
stringCamelizedStringLikeThis.
classify(string $tableName)
Returns Cake model class name ("Person" for the database table "people".) for given database table.
string $tableName Name of database table to get class name for
stringClass name
dasherize(string $string)
Returns the input CamelCasedString as an dashed-string.
Also replaces underscores with dashes
string $string The string to dasherize.
stringDashed version of the input string
delimit(string $string, string $delimiter)
Expects a CamelCasedInputString, and produces a lower_case_delimited_string
string $string String to delimit
string $delimiter optional the character to use as a delimiter
stringdelimited string
humanize(string $string, string $delimiter)
Returns the input lower_case_delimited_string as 'A Human Readable String'.
(Underscores are replaced by spaces and capitalized following words.)
string $string String to be humanized
string $delimiter optional the character to replace with a space
stringHuman-readable string
pluralize(string $word)
Return $word in plural form.
string $word Word in singular
stringWord in plural
reset()
Clears Inflectors inflected value caches. And resets the inflection rules to the initial values.
rules(string $type, array $rules, bool $reset)
Adds custom inflection $rules, of either 'plural', 'singular', 'uninflected' or 'irregular' $type.
Inflector::rules('plural', ['/^(inflect)or$/i' => '\1ables']);
Inflector::rules('irregular', ['red' => 'redlings']);
Inflector::rules('uninflected', ['dontinflectme']); string $type The type of inflection, either 'plural', 'singular', or 'uninflected'.
array $rules Array of rules to be added.
bool $reset optional If true, will unset default inflections for all new rules that are being defined in $rules.
singularize(string $word)
Return $word in singular form.
string $word Word in plural
stringWord in singular
tableize(string $className)
Returns corresponding table name for given model $className. ("people" for the model class "Person").
string $className Name of class to get database table name for
stringName of the database table for given class
underscore(string $string)
Returns the input CamelCasedString as an underscored_string.
Also replaces dashes with underscores
string $string CamelCasedString to be "underscorized"
stringunderscore_version of the input string
variable(string $string)
Returns camelBacked version of an underscored string.
string $string String to convert.
stringin variable form
Method cache array.
arrayThe initial state of Inflector so reset() works.
arrayIrregular rules
arrayPlural inflector rules
arraySingular inflector rules
arrayWords that should not be inflected
array
© 2005–present The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/4.1/class-Cake.Utility.Inflector.html