/** * en_GB (old version) and en_US differentiate in their millions/billions/trillions * because en_GB once used the long scale, and en_US the short scale. * * We're testing the short scale here. */ public function testMore() { $this->assertEquals('un milion', $this->transformer->toWords(new Number(1000000))); $this->assertEquals('două miliarde', $this->transformer->toWords(new Number(2000000000))); // 32 bit systems vs PHP_INT_SIZE - 3 trillion is a little high, so use a string version. $number = '3000000000000' > PHP_INT_SIZE ? '3000000000000' : 3000000000000; $this->assertEquals('trei trilioane', $this->transformer->toWords(new Number($number))); }
/** * Converts a currency value to its word representation * (with monetary units) in Romanian * * @param string $int_curr An international currency symbol * as defined by the ISO 4217 standard (three characters) * @param integer $decimal A money total amount without fraction part (e.g. amount of dollars) * @param integer $fraction Fractional part of the money amount (e.g. amount of cents) * Optional. Defaults to false. * @param integer $convert_fraction Convert fraction to words (left as numeric if set to false). * Optional. Defaults to true. * * @return string The corresponding word representation for the currency * * @access public * @author Bogdan Stăncescu <*****@*****.**> */ private function toCurrencyWords($int_curr, $decimal, $fraction = false, $convert_fraction = true) { $int_curr = strtoupper($int_curr); if (!isset(Currency::getCurrencyNames()[$int_curr])) { $int_curr = 'EUR'; } $curr_nouns = Currency::getCurrencyNames()[$int_curr]; $ret = $this->transformer->toWords(new Number($decimal), $curr_nouns[0]); if ($fraction !== false) { $ret .= ' ' . Language::WORD_AND; if ($convert_fraction) { $ret .= ' ' . $this->toWords(new Amount(new Number($fraction), new \Kwn\NumberToWords\Model\Currency($int_curr)), $curr_nouns[1]); } else { $ret .= $fraction . ' '; $plural_rule = $this->_get_plural_rule($fraction); $this->_get_noun_declension_for_number($plural_rule, $curr_nouns[1]); } } return trim($ret); }