API / Minn\I18n / PluralRule

PluralRule final readonly class

Minn\I18n\PluralRule · public/minn/src/Minn/I18n/PluralRule.php · 36 lines

A language's plural rule from its Plural-Forms header: how many forms it has and which form a number takes. A file without the header follows English (two forms, n != 1); an expression that does not parse sends every number to the first form, as the reference does.

Used by 1

Constants and properties

propreadonly int $count

Promoted from the constructor.

propreadonly string $expression

Promoted from the constructor.

privatereadonly ?array $tree

Promoted from the constructor.

Public

new__construct(int $count, string $expression, ?array $tree)#
$treearray<int, mixed>|null
staticenglish(): self#

English: one form for 1, the other for everything else.

staticfromHeader(?string $header): self#

The rule a Plural-Forms header states.

staticfromExpression(int $count, string $expression): self#

A rule from a form count and an expression in n.

methodindex(int $n): int#

The form a number takes.