Zend\I18n\Translator\Plural\Rule
Plural rule evaluator.
Synopsis
class Rule
{
- // members
- protected Parser $parser;
- protected array $ast;
- protected int $numPlurals;
- // methods
- protected Rule __construct()
- public int evaluate()
- public int getNumPlurals()
- protected int evaluateAstPart()
- public static Rule fromString()
- protected static array createAst()
Members
protected
- $ast
—
array
Abstract syntax tree. - $numPlurals
—
int
Number of plurals in this rule. - $parser
—
Zend\I18n\Translator\Plural\Parser
Parser instance.
Methods
protected
- __construct() — Create a new plural rule.
- createAst() — Create an AST from a tree.
- evaluateAstPart() — Evaluate a part of an ast.
public
- evaluate() — Evaluate a number and return the plural index.
- fromString() — Create a new rule from a string.
- getNumPlurals() — Get number of possible plural forms.