Inflector
Extends InflectorJoomla Framework String Inflector Class
The Inflector transforms words
since |
1.0 |
---|---|
package |
Joomla Framework |
Methods
addCountableRule
Adds a countable word.
addCountableRule(mixed data) : $this
since |
1.0 |
---|
Arguments
- data
mixed
A string or an array of strings to add.
Response
$this
addPluraliseRule
Adds a pluralisation rule.
addPluraliseRule(mixed data) : $this
since |
1.0 |
---|---|
deprecated |
3.0 Use Doctrine\Common\Inflector\Inflector::rules() instead. |
Arguments
- data
mixed
A string or an array of regex rules to add.
Response
$this
addRule
Adds inflection regex rules to the inflector.
addRule(mixed data, string ruleType) : void
since |
1.0 |
---|---|
throws |
|
Arguments
- data
mixed
A string or an array of strings or regex rules to add.- ruleType
string
The rule type: singular | plural | countable
addSingulariseRule
Adds a singularisation rule.
addSingulariseRule(mixed data) : $this
since |
1.0 |
---|---|
deprecated |
3.0 Use Doctrine\Common\Inflector\Inflector::rules() instead. |
Arguments
- data
mixed
A string or an array of regex rules to add.
Response
$this
addWord
Adds a specific singular-plural pair for a word.
addWord(string singular, string plural = '') : $this
since |
1.0 |
---|---|
deprecated |
3.0 Use Doctrine\Common\Inflector\Inflector::rules() instead. |
Arguments
- singular
string
The singular form of the word.- plural
string
The plural form of the word. If omitted, it is assumed the singular and plural are identical.
Response
$this
getInstance
Gets an instance of the Inflector singleton.
getInstance(bool new = false) : static
since |
1.0 |
---|---|
deprecated |
3.0 Use static methods without a class instance instead. |
Arguments
- new
bool
If true (default is false), returns a new instance regardless if one exists. This argument is mainly used for testing.
Response
static
isCountable
Checks if a word is countable.
isCountable(string word) : bool
since |
1.0 |
---|
Arguments
- word
string
The string input.
Response
bool
True if word is countable, false otherwise.
isPlural
Checks if a word is in a plural form.
isPlural(string word) : bool
since |
1.0 |
---|
Arguments
- word
string
The string input.
Response
bool
True if word is plural, false if not.
isSingular
Checks if a word is in a singular form.
isSingular(string word) : bool
since |
1.0 |
---|
Arguments
- word
string
The string input.
Response
bool
True if word is singular, false if not.
toPlural
Converts a word into its plural form.
toPlural(string word) : string
since |
1.0 |
---|---|
deprecated |
3.0 Use Doctrine\Common\Inflector\Inflector::pluralize() instead. |
Arguments
- word
string
The singular word to pluralise.
Response
string
The word in plural form.
toSingular
Converts a word into its singular form.
toSingular(string word) : string
since |
1.0 |
---|---|
deprecated |
3.0 Use Doctrine\Common\Inflector\Inflector::singularize() instead. |
Arguments
- word
string
The plural word to singularise.
Response
string
The word in singular form.
Properties
instance
The singleton instance.
since |
1.0 |
---|---|
deprecated |
3.0 |
Type(s)
\Joomla\String\Inflector
countable
The inflector rules for countability.
since |
2.0.0 |
---|
Type(s)
array