Пример #1
0
 /**
  * Create a currency
  *
  * @param string $code Currency 3 letter ISO4217 code
  * @param int $value initial value for currency
  *
  * @return Currency
  */
 public static function create($code, $value = 0)
 {
     $cd = strtoupper($code);
     list($symbol, $precision, $name) = self::getDefinition($cd);
     $crcy = new Currency($value, $cd, $symbol, $precision, $name);
     $crcy->setLocale(self::getLocale());
     return $crcy;
 }
Пример #2
0
 public function testDisplayObeysLocaleRules()
 {
     $this->assertEquals('£1,200.26', $this->sut->display());
     $this->sut->setLocale(new StringType('fr_FR'));
     $this->assertEquals('1 200,26 £', $this->sut->display());
     $this->sut->setLocale(new StringType('de_DE'));
     $this->assertEquals('1.200,26 £', $this->sut->display());
 }
Пример #3
0
 /**
  * Add to credit amount for this account
  * Will update parent account if required
  *
  * @param Currency $amount
  * @return $this
  */
 public function credit(Currency $amount)
 {
     $this->acCr->set($this->acCr->get() + $amount());
     Match::on($this->optGetParentId())->Monad_Option_Some(function ($parentId) use($amount) {
         $this->chart->getAccount($parentId->value())->credit($amount);
     });
     return $this;
 }
Пример #4
0
 /**
  * @return StringType
  */
 public function getCurrencyCode()
 {
     return $this->crcy->getCode();
 }