\Inflector
Pluralize and singularize English words.
Inflector pluralizes and singularizes English nouns.
Used by Cake's naming conventions throughout the framework.
Synopsis
class Inflector
{
- // members
- protected static array $_plural = ;
- protected static array $_singular = ;
- protected static array $_uninflected = ;
- protected static array $_transliteration = ;
- protected static array $_cache = ;
- protected static array $_initialState = ;
- // methods
- protected static string _cache()
- public static void reset()
- public static void rules()
- public static string pluralize()
- public static string singularize()
- public static string camelize()
- public static string underscore()
- public static string humanize()
- public static string tableize()
- public static string classify()
- public static string variable()
- public static string slug()
Members
protected
- $_cache
—
array
Method cache array. - $_initialState
—
array
The initial state of Inflector so reset() works. - $_plural
—
array
Plural inflector rules - $_singular
—
array
Singular inflector rules - $_transliteration
—
array
Default map of accented and special characters to ASCII characters - $_uninflected
—
array
Words that should not be inflected
Methods
protected
- _cache() — Cache inflected values, and return if already available
public
- camelize() — Returns the given lower_case_and_underscored_word as a CamelCased word.
- classify() — Returns Cake model class name ("Person" for the database table "people".) for given database table.
- humanize() — Returns the given underscored_word_group as a Human Readable Word Group.
- pluralize() — Return $word in plural form.
- reset() — Clears Inflectors inflected value caches. And resets the inflection rules to the initial values.
- rules() — Adds custom inflection $rules, of either 'plural', 'singular' or 'transliteration' $type.
- singularize() — Return $word in singular form.
- slug() — Returns a string with all spaces converted to underscores (by default), accented characters converted to non-accented characters, and non word characters removed.
- tableize() — Returns corresponding table name for given model $className. ("people" for the model class "Person").
- underscore() — Returns the given camelCasedWord as an underscored_word.
- variable() — Returns camelBacked version of an underscored string.