Pluralize and singularize English words.
Inflector pluralizes and singularizes English nouns. Used by CakePHP's naming conventions throughout the framework.
array
Method cache array.
array
The initial state of Inflector so reset() works.
array
Irregular rules
array
Plural inflector rules
array
Singular inflector rules
array
Words 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|false
Inflected 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
string
CamelizedStringLikeThis.
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
string
Class name
dasherize(string $string)
Returns the input CamelCasedString as an dashed-string.
Also replaces underscores with dashes
string
$string The string to dasherize.
string
Dashed 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
string
delimited 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
string
Human-readable string
pluralize(string $word)
Return $word in plural form.
string
$word Word in singular
string
Word 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
string
Word 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
string
Name 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"
string
underscore_version of the input string
variable(string $string)
Returns camelBacked version of an underscored string.
string
$string String to convert.
string
in variable form
Method cache array.
array
The initial state of Inflector so reset() works.
array
Irregular rules
array
Plural inflector rules
array
Singular inflector rules
array
Words 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