Esempio n. 1
0
 /**
  * Get the plural form to be used.
  *
  * If $quantity is non-NULL, the plural form for provided $locale will be
  * chosen according to it.
  *
  * Otherwise, if $arguments contains exactly one numeric element, it is
  * automatically used as the $quantity.
  *
  * In all other cases, NULL is returned.
  *
  * @param mixed $quantity
  * @param array $arguments
  * @param \TYPO3\FLOW3\I18n\Locale $locale
  * @return string
  */
 protected function getPluralForm($quantity, array $arguments, Locale $locale)
 {
     if (!is_numeric($quantity)) {
         if (count($arguments) === 1) {
             return is_numeric(current($arguments)) ? $this->pluralsReader->getPluralForm(current($arguments), $locale) : NULL;
         } else {
             return NULL;
         }
     } else {
         return $this->pluralsReader->getPluralForm($quantity, $locale);
     }
 }
Esempio n. 2
0
 /**
  * @test
  * @dataProvider quantities
  */
 public function returnsCorrectPluralForm($quantity, $pluralForm)
 {
     $locale = new \TYPO3\FLOW3\I18n\Locale('mo');
     $result = $this->reader->getPluralForm($quantity, $locale);
     $this->assertEquals($pluralForm, $result);
 }