getPluralRule()) { throw new Exception\InvalidArgumentException(sprintf( 'No plural rule was set' )); } if (! is_array($strings)) { $strings = (array) $strings; } $pluralIndex = $this->getPluralRule()->evaluate($number); return $strings[$pluralIndex]; } /** * Set the plural rule to use * * @param PluralRule|string $pluralRule * @return $this */ public function setPluralRule($pluralRule) { if (! $pluralRule instanceof PluralRule) { $pluralRule = PluralRule::fromString($pluralRule); } $this->rule = $pluralRule; return $this; } /** * Get the plural rule to use * * @return PluralRule */ public function getPluralRule() { return $this->rule; } }