Class JStringInflector

Description

Joomla Platform String Inflector Class

The Inflector transforms words

  • since: 12.1

Located in /libraries/joomla/string/inflector.php (line 21)


	
			
Method Summary
 static JStringInflector getInstance ([boolean $new = false])
 JStringInflector __construct ()
 JStringInflector addWord (string $singular, [string $plural = null])
 boolean isCountable (string $word)
 boolean isPlural (string $word)
 boolean isSingular (string $word)
 mixed toPlural (string $word)
 mixed toSingular (string $word)
Methods
static getInstance (line 319)

Gets an instance of the JStringInflector singleton.

  • since: 12.1
  • access: public
static JStringInflector getInstance ([boolean $new = false])
  • boolean $new: If true (default is false), returns a new instance regardless if one exists. This argument is mainly used for testing.
Constructor __construct (line 91)

Protected constructor.

  • since: 12.1
  • access: protected
JStringInflector __construct ()
addCountableRule (line 253)

Adds a countable word.

  • return: Returns this object to support chaining.
  • since: 12.1
  • access: public
JStringInflector addCountableRule (mixed $data)
  • mixed $data: A string or an array of strings to add.
addPluraliseRule (line 286)

Adds a pluralisation rule.

  • return: Returns this object to support chaining.
  • since: 12.1
  • access: public
JStringInflector addPluraliseRule (mixed $data)
  • mixed $data: A string or an array of regex rules to add.
addSingulariseRule (line 302)

Adds a singularisation rule.

  • return: Returns this object to support chaining.
  • since: 12.1
  • access: public
JStringInflector addSingulariseRule (mixed $data)
  • mixed $data: A string or an array of regex rules to add.
addWord (line 270)

Adds a specific singular-plural pair for a word.

  • return: Returns this object to support chaining.
  • since: 12.1
  • access: public
JStringInflector addWord (string $singular, [string $plural = null])
  • 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.
isCountable (line 342)

Checks if a word is countable.

  • return: True if word is countable, false otherwise.
  • since: 12.1
  • access: public
boolean isCountable (string $word)
  • string $word: The string input.
isPlural (line 356)

Checks if a word is in a plural form.

  • return: True if word is plural, false if not.
  • since: 12.1
  • access: public
boolean isPlural (string $word)
  • string $word: The string input.
isSingular (line 379)

Checks if a word is in a singular form.

  • return: True if word is singular, false if not.
  • since: 12.1
  • access: public
boolean isSingular (string $word)
  • string $word: The string input.
toPlural (line 402)

Converts a word into its plural form.

  • return: An inflected string, or false if no rule could be applied.
  • since: 12.1
  • access: public
mixed toPlural (string $word)
  • string $word: The singular word to pluralise.
toSingular (line 440)

Converts a word into its singular form.

  • return: An inflected string, or false if no rule could be applied.
  • since: 12.1
  • access: public
mixed toSingular (string $word)
  • string $word: The plural word to singularise.

Documentation generated on Tue, 19 Nov 2013 15:05:32 +0100 by phpDocumentor 1.4.3