Gets an instance of the JStringInflector singleton.
-
boolean
$new: If true (default is false), returns a new instance regardless if one exists. This argument is mainly used for testing.
Protected constructor.
JStringInflector
__construct
()
Adds a countable word.
-
mixed
$data: A string or an array of strings to add.
Adds a pluralisation rule.
-
mixed
$data: A string or an array of regex rules to add.
Adds a singularisation rule.
-
mixed
$data: A string or an array of regex rules to add.
Adds a specific singular-plural pair for a word.
-
string
$singular: The singular form of the word.
-
string
$plural: The plural form of the word. If omitted, it is assumed the singular and plural are identical.
Checks if a word is countable.
boolean
isCountable
(string $word)
-
string
$word: The string input.
Checks if a word is in a plural form.
boolean
isPlural
(string $word)
-
string
$word: The string input.
Checks if a word is in a singular form.
boolean
isSingular
(string $word)
-
string
$word: The string input.
Converts a word into its plural form.
mixed
toPlural
(string $word)
-
string
$word: The singular word to pluralise.
Converts a word into its singular form.
mixed
toSingular
(string $word)
-
string
$word: The plural word to singularise.