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(mixed data) : $this
since

1.0

Arguments

data

mixedA string or an array of strings to add.

Response

$this

addPluraliseRule

Adds a pluralisation rule.

addPluraliseRule(mixed data) : $this
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(mixed data, string ruleType) : void
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

addSingulariseRule

Adds a singularisation rule.

addSingulariseRule(mixed data) : $this
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(string singular, string plural = '') : $this
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(bool new = false) : static
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(string word) : bool
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(string word) : bool
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(string word) : bool
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(string word) : string
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(string word) : string
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)

\Joomla\String\Inflector

countable

The inflector rules for countability.

static
since

2.0.0

Type(s)

array