Fournit des méthodes afin de travailler avec la pluralisation et la singularisation des mots ainsi que des méthodes afin de travailler avec les phrases.
uncountable($string) vérifie si le mot fournit est un mot “comptable” ou non. Retourne TRUE ou FALSE. Cette méthode utilise une liste de mot à partir du fichier inflector.php, qui se situe dans le dossier system/config
inflector::uncountable('money'); //retourne TRUE inflector::uncountable('book'); //retourne FALSE
singular($str, $count = NULL) will attempt to singularize the given string. Returns the string. If a string is uncountable it will return the string without modification.
Note: this function works for English words only.
inflector::singular('books'); //returns 'book' inflector::singular('books',0); //returns 'books'
plural($str, $count = NULL) will attempt to pluralize the given string. Returns the string. If a string is uncountable it will return the string without modification.
Note: this function works for English words only.
inflector::plural('book'); //returns 'books' inflector::plural('book',1); //returns 'book'
camelize($str) will attempt to camelize the given string. Returns the string.
inflector::camelize('system_initialization'); //returns 'systemInitialization' inflector::camelize('system initialization'); //returns 'systemInitialization'
underscore($str) makes a phrase underscored instead of spaced. Returns the string.
inflector::underscore('Underscores a phrase.'); //returns Underscores_a_phrase.'
humanize($str) makes a phrase human-readable instead of dashed or underscored. Returns the string.
inflector::humanize('Remove_underscores_from_a_phrase.'); //returns 'Remove underscores from a phrase.' inflector::humanize('Remove-dashes-from-a-phrase.'); //returns 'Remove dashes from a phrase.'