Joomla Framework String Inflector Class
The Inflector transforms words
- Depuis
- 1.0
◆ __construct()
Protected constructor.
- Depuis
- 1.0
◆ addCountableRule()
addCountableRule |
( |
|
$data | ) |
|
Adds a countable word.
- Paramètres
-
mixed | $data | A string or an array of strings to add. |
- Renvoie
- Inflector Returns this object to support chaining.
- Depuis
- 1.0
Références $data, et Inflector\addRule().
◆ addPluraliseRule()
addPluraliseRule |
( |
|
$data | ) |
|
Adds a pluralisation rule.
- Paramètres
-
mixed | $data | A string or an array of regex rules to add. |
- Renvoie
- Inflector Returns this object to support chaining.
- Depuis
- 1.0
Références $data, et Inflector\addRule().
◆ addRule()
addRule |
( |
|
$data, |
|
|
|
$ruleType |
|
) |
| |
|
private |
◆ addSingulariseRule()
addSingulariseRule |
( |
|
$data | ) |
|
Adds a singularisation rule.
- Paramètres
-
mixed | $data | A string or an array of regex rules to add. |
- Renvoie
- Inflector Returns this object to support chaining.
- Depuis
- 1.0
Références $data, et Inflector\addRule().
◆ addWord()
addWord |
( |
|
$singular, |
|
|
|
$plural = null |
|
) |
| |
Adds a specific singular-plural pair for a word.
- Paramètres
-
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. |
- Renvoie
- Inflector Returns this object to support chaining.
- Depuis
- 1.0
Références Inflector\setCache().
◆ getCachedPlural()
getCachedPlural |
( |
|
$singular | ) |
|
|
private |
◆ getCachedSingular()
getCachedSingular |
( |
|
$plural | ) |
|
|
private |
◆ getInstance()
static getInstance |
( |
|
$new = false | ) |
|
|
static |
Gets an instance of the JStringInflector singleton.
- Paramètres
-
boolean | $new | If true (default is false), returns a new instance regardless if one exists. This argument is mainly used for testing. |
- Renvoie
- Inflector
- Depuis
- 1.0
◆ isCountable()
Checks if a word is countable.
- Paramètres
-
string | $word | The string input. |
- Renvoie
- boolean True if word is countable, false otherwise.
- Depuis
- 1.0
◆ isPlural()
◆ isSingular()
◆ matchRegexRule()
matchRegexRule |
( |
|
$word, |
|
|
|
$ruleType |
|
) |
| |
|
private |
Execute a regex from rules.
The 'plural' rule type expects a singular word. The 'singular' rule type expects a plural word.
- Paramètres
-
string | $word | The string input. |
string | $ruleType | String (eg, singular|plural) |
- Renvoie
- string|boolean An inflected string, or false if no rule could be applied.
- Depuis
- 1.0
Référencé par Inflector\toPlural(), et Inflector\toSingular().
◆ setCache()
setCache |
( |
|
$singular, |
|
|
|
$plural = null |
|
) |
| |
|
private |
◆ toPlural()
◆ toSingular()
◆ $cache
◆ $instance
◆ $rules
La documentation de cette classe a été générée à partir du fichier suivant :