Plural rule evaluator.

category Zend
package Zend_I18n
subpackage Translator

 Methods

Evaluate a number and return the plural index.

evaluate(integer $number) : integer

Parameters

$number

integer

Exceptions

\Zend\I18n\Exception\RangeException

Returns

integer

Create a new rule from a string.

fromString(string $string) : \Zend\I18n\Translator\Plural\Rule

Parameters

$string

string

Exceptions

\Zend\I18n\Exception\ParseException

Returns

Create a new plural rule.

__construct(integer $numPlurals, array $ast) : \Zend\I18n\Translator\Plural\Rule

Parameters

$numPlurals

integer

$ast

array

Returns

Create an AST from a tree.

createAst(\Zend\I18n\Translator\Plural\Symbol $symbol) : array

Theoretically we could just use the given Symbol, but that one is not so easy to serialize and also takes up more memory.

Parameters

Returns

array

Evaluate a part of an ast.

evaluateAstPart(array $ast, integer $number) : integer

Parameters

$ast

array

$number

integer

Exceptions

\Zend\I18n\Exception\ParseException

Returns

integer

 Properties

 

Abstract syntax tree.

$ast : array

 

Number of plurals in this rule.

$numPlurals : integer

 

Parser instance.

$parser : \Zend\I18n\Translator\Plural\Parser