Inflector

Extends Inflector

Joomla Framework String Inflector Class

The Inflector transforms words

since

1.0

package

Joomla Framework

Methods

addCountableRule

Adds a countable word.

addCountableRule( data) : 
since

1.0

Arguments

data

mixedA string or an array of strings to add.

Response

$this

addPluraliseRule

Adds a pluralisation rule.

addPluraliseRule( data) : 
deprecated
since

1.0

deprecated

3.0 Use Doctrine\Common\Inflector\Inflector::rules() instead.

Arguments

data

mixedA string or an array of regex rules to add.

Response

$this

addRule

Adds inflection regex rules to the inflector.

addRule( data,  ruleType) : 
since

1.0

throws

InvalidArgumentException

Arguments

data

mixedA string or an array of strings or regex rules to add.

ruleType

stringThe rule type: singular | plural | countable

Response

void

addSingulariseRule

Adds a singularisation rule.

addSingulariseRule( data) : 
deprecated
since

1.0

deprecated

3.0 Use Doctrine\Common\Inflector\Inflector::rules() instead.

Arguments

data

mixedA string or an array of regex rules to add.

Response

$this

addWord

Adds a specific singular-plural pair for a word.

addWord( singular,  plural = '') : 
deprecated
since

1.0

deprecated

3.0 Use Doctrine\Common\Inflector\Inflector::rules() instead.

Arguments

singular

stringThe singular form of the word.

plural

stringThe 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( new = false) : 
static deprecated
since

1.0

deprecated

3.0 Use static methods without a class instance instead.

Arguments

new

boolIf 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( word) : 
since

1.0

Arguments

word

stringThe string input.

Response

boolTrue if word is countable, false otherwise.

isPlural

Checks if a word is in a plural form.

isPlural( word) : 
since

1.0

Arguments

word

stringThe string input.

Response

boolTrue if word is plural, false if not.

isSingular

Checks if a word is in a singular form.

isSingular( word) : 
since

1.0

Arguments

word

stringThe string input.

Response

boolTrue if word is singular, false if not.

toPlural

Converts a word into its plural form.

toPlural( word) : 
deprecated
since

1.0

deprecated

3.0 Use Doctrine\Common\Inflector\Inflector::pluralize() instead.

Arguments

word

stringThe singular word to pluralise.

Response

stringThe word in plural form.

toSingular

Converts a word into its singular form.

toSingular( word) : 
deprecated
since

1.0

deprecated

3.0 Use Doctrine\Common\Inflector\Inflector::singularize() instead.

Arguments

word

stringThe plural word to singularise.

Response

stringThe word in singular form.

Properties

instance

The singleton instance.

static deprecated
since

1.0

deprecated

3.0

Type(s)

Inflector

countable

The inflector rules for countability.

static
since

2.0.0

Type(s)

array<string|int, mixed>