[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/vendor/joomla/string/src/ -> Inflector.php (summary)

Part of the Joomla Framework String Package

Copyright: Copyright (C) 2005 - 2021 Open Source Matters, Inc. All rights reserved.
License: GNU General Public License version 2 or later; see LICENSE
File Size: 327 lines (7 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Inflector:: (11 methods):
  addRule()
  addCountableRule()
  addWord()
  addPluraliseRule()
  addSingulariseRule()
  getInstance()
  isCountable()
  isPlural()
  isSingular()
  toPlural()
  toSingular()


Class: Inflector  - X-Ref

Joomla Framework String Inflector Class

The Inflector transforms words

addRule($data, string $ruleType)   X-Ref
Adds inflection regex rules to the inflector.

param: mixed   $data      A string or an array of strings or regex rules to add.
param: string  $ruleType  The rule type: singular | plural | countable
return: void

addCountableRule($data)   X-Ref
Adds a countable word.

param: mixed  $data  A string or an array of strings to add.
return: $this

addWord($singular, $plural = '')   X-Ref
Adds a specific singular-plural pair for a word.

param: string  $singular  The singular form of the word.
param: string  $plural    The plural form of the word. If omitted, it is assumed the singular and plural are identical.
return: $this

addPluraliseRule($data)   X-Ref
Adds a pluralisation rule.

param: mixed  $data  A string or an array of regex rules to add.
return: $this

addSingulariseRule($data)   X-Ref
Adds a singularisation rule.

param: mixed  $data  A string or an array of regex rules to add.
return: $this

getInstance($new = false)   X-Ref
Gets an instance of the Inflector singleton.

param: boolean  $new  If true (default is false), returns a new instance regardless if one exists. This argument is mainly used for testing.
return: static

isCountable($word)   X-Ref
Checks if a word is countable.

param: string  $word  The string input.
return: boolean  True if word is countable, false otherwise.

isPlural($word)   X-Ref
Checks if a word is in a plural form.

param: string  $word  The string input.
return: boolean  True if word is plural, false if not.

isSingular($word)   X-Ref
Checks if a word is in a singular form.

param: string  $word  The string input.
return: boolean  True if word is singular, false if not.

toPlural($word)   X-Ref
Converts a word into its plural form.

param: string  $word  The singular word to pluralise.
return: string  The word in plural form.

toSingular($word)   X-Ref
Converts a word into its singular form.

param: string  $word  The plural word to singularise.
return: string  The word in singular form.



Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer