Property | Type | Description | |
---|---|---|---|
$plurals | the rules for converting a word into its plural form. The keys are the regular expressions and the values are the corresponding replacements. | ||
$singulars | the rules for converting a word into its singular form. The keys are the regular expressions and the values are the corresponding replacements. | ||
$specials | the special rules for converting a word between its plural form and singular form. The keys are the special words in singular form, and the values are the corresponding plural form. | ||
$transliteration | fallback map for transliteration used by BaseInflector::transliterate when intl isn't available. | ||
$transliterator | Either a [[\Transliterator]], or a string from which a [[\Transliterator]] can be built for transliteration. Used by BaseInflector::transliterate when intl is available. Defaults to [[TRANSLITERATE_LOOSE]] |
Method | Description | |
---|---|---|
camel2id ( string $name, string $separator = '-', boolean | string $strict = false ) : string | Converts a CamelCase name into an ID in lowercase. | |
camel2words ( string $name, boolean $ucwords = true ) : string | Converts a CamelCase name into space-separated words. | |
camelize ( string $word ) : string | Returns given word as CamelCased Converts a word like "send_email" to "SendEmail". It will remove non alphanumeric character from the word, so "who's online" will be converted to "WhoSOnline" | |
classify ( string $tableName ) : string | Converts a table name to its class name. For example, converts "people" to "Person" | |
humanize ( string $word, boolean $ucAll = false ) : string | Returns a human-readable string from $word | |
id2camel ( string $id, string $separator = '-' ) : string | Converts an ID into a CamelCase name. | |
ordinalize ( integer $number ) : string | Converts number to its ordinal English form. For example, converts 13 to 13th, 2 to 2nd . | |
pluralize ( string $word ) : string | Converts a word to its plural form. | |
sentence ( array $words, string $twoWordsConnector = ' and ', string $lastWordConnector = null, string $connector = ', ' ) : string | Converts a list of words into a sentence. | |
singularize ( string $word ) : string | Returns the singular of the $word | |
slug ( string $string, string $replacement = '-', boolean $lowercase = true ) : string | Returns a string with all spaces converted to given replacement, non word characters removed and the rest of characters transliterated. | |
tableize ( string $className ) : string | Converts a class name to its table name (pluralized) naming conventions. For example, converts "Person" to "people" | |
titleize ( string $words, boolean $ucAll = false ) : string | Converts an underscored or CamelCase word into a English sentence. | |
transliterate ( string $string, string | Transliterator $transliterator = null ) : string | Returns transliterated version of a string. | |
underscore ( string $words ) : string | Converts any "CamelCased" into an "underscored_word". | |
variablize ( string $word ) : string | Same as camelize but first char is in lowercase. |
Method | Description | |
---|---|---|
hasIntl ( ) : boolean |
public static camel2id ( string $name, string $separator = '-', boolean | string $strict = false ) : string | ||
$name | string | the string to be converted |
$separator | string | the character used to concatenate the words in the ID |
$strict | boolean | string | whether to insert a separator between two consecutive uppercase chars, defaults to false |
return | string | the resulting ID |
public static ordinalize ( integer $number ) : string | ||
$number | integer | the number to get its ordinal value |
return | string |
public static sentence ( array $words, string $twoWordsConnector = ' and ', string $lastWordConnector = null, string $connector = ', ' ) : string | ||
$words | array | the words to be converted into an string |
$twoWordsConnector | string | the string connecting words when there are only two |
$lastWordConnector | string | the string connecting the last two words. If this is null, it will take the value of `$twoWordsConnector`. |
$connector | string | the string connecting words other than those connected by $lastWordConnector and $twoWordsConnector |
return | string | the generated sentence |
public static singularize ( string $word ) : string | ||
$word | string | the english word to singularize |
return | string | Singular noun. |
public static slug ( string $string, string $replacement = '-', boolean $lowercase = true ) : string | ||
$string | string | An arbitrary string to convert |
$replacement | string | The replacement to use for spaces |
$lowercase | boolean | whether to return the string in lowercase or not. Defaults to `true`. |
return | string | The converted string. |
public static underscore ( string $words ) : string | ||
$words | string | the word(s) to underscore |
return | string |
public static variablize ( string $word ) : string | ||
$word | string | to lowerCamelCase |
return | string |
public static $plurals |
public static $singulars |
public static $specials |
public static $transliteration |
public static $transliterator |