/** * Output a formatted currency * * @param integer|float $value Currency value to output * @param string|Zend_Locale|\Zend\Currency\Currency $currency OPTIONAL Currency to use for this call * @return string Formatted currency */ public function direct($value = null, $currency = null) { if ($value === null) { return $this; } if (is_string($currency) || $currency instanceof Locale\Locale) { if (Locale\Locale::isLocale($currency)) { $currency = array('locale' => $currency); } } if (is_string($currency)) { $currency = array('currency' => $currency); } if (is_array($currency)) { return $this->_currency->toCurrency($value, $currency); } return $this->_currency->toCurrency($value); }
/** * @ZF-9941 */ public function testSetValueByOutput() { $currency = new Currency\Currency(array('value' => 1000, 'locale' => 'de_AT')); $this->assertEquals('€ 2.000,00', $currency->toCurrency(null, array('value' => 2000))); }
/** * Modulo values */ public function testModValues() { $currency = new Currency\Currency(array('currency' => 'EUR', 'locale' => 'de_AT')); $currency->add(801); $currency->mod(2); $this->assertEquals('€ 1,00', $currency->toCurrency()); }