MediaWiki
1.23.2
|
Static Public Member Functions | |
static | compile (array $rules) |
Convert a set of rules to a compiled form which is optimised for fast evaluation. More... | |
static | evaluate ( $number, array $rules) |
Evaluate a number against a set of plural rules. More... | |
static | evaluateCompiled ( $number, array $rules) |
Evaluate a compiled set of rules returned by compile(). More... | |
Static Private Member Functions | |
static | doOperation ( $token, $left, $right) |
Do a single operation. More... | |
Definition at line 34 of file CLDRPluralRuleEvaluator.php.
|
static |
Convert a set of rules to a compiled form which is optimised for fast evaluation.
The result will be an array of strings, and may be cached.
array | $rules | The rules to compile |
Definition at line 55 of file CLDRPluralRuleEvaluator.php.
References as, and CLDRPluralRuleConverter\convert().
Referenced by evaluate(), and LocalisationCache\getCompiledPluralRules().
|
staticprivate |
Do a single operation.
string | $token | The token string |
mixed | $left | The left operand. If it is an object, its state may be destroyed. |
mixed | $right | The right operand |
CLDRPluralRuleError |
Definition at line 140 of file CLDRPluralRuleEvaluator.php.
References $right, and array().
Referenced by evaluateCompiled().
|
static |
Evaluate a number against a set of plural rules.
If a rule passes, return the index of plural rule.
int | $number | The number to be evaluated against the rules |
array | $rules | The associative array of plural rules in pluralform => rule format. |
Definition at line 43 of file CLDRPluralRuleEvaluator.php.
References compile(), and evaluateCompiled().
Referenced by CLDRPluralRuleEvaluatorTest\testInvalidRules(), and CLDRPluralRuleEvaluatorTest\testValidRules().
|
static |
Evaluate a compiled set of rules returned by compile().
Do not allow the user to edit the compiled form, or else PHP errors may result.
string | $number | The number to be evaluated against the rules, in English, or it may be a type convertible to string. |
array | $rules | The associative array of plural rules in pluralform => rule format. |
Definition at line 73 of file CLDRPluralRuleEvaluator.php.
References $right, array(), as, doOperation(), StringUtils\explode(), and wfDebug().
Referenced by evaluate(), and Language\getPluralRuleIndexNumber().