public function testResetCurrencies() { $currencies = Currency::getCurrencies(); Currency::setCurrencies([]); $this->assertEmpty(Currency::getCurrencies()); Currency::setCurrencies($currencies); }
/** * Bootstrap the application events. * * @return void */ public function boot() { $config = __DIR__ . '/../../config/money.php'; $this->mergeConfigFrom($config, 'clicknow.money'); $this->publishes([$config => $this->app->make('path.config') . '/clicknow.money.php'], 'config'); Money::setLocale($this->app->make('translator')->getLocale()); Currency::setCurrencies($this->app->make('config')->get('clicknow.money')); }
/** * format. * * @return string */ public function format() { $negative = $this->isNegative(); $value = $this->getValue(); $amount = $negative ? -$value : $value; $thousands = $this->currency->getThousandsSeparator(); $decimals = $this->currency->getDecimalMark(); $prefix = $this->currency->getPrefix(); $suffix = $this->currency->getSuffix(); $value = number_format($amount, 2, $decimals, $thousands); return ($negative ? '-' : '') . $prefix . $value . $suffix; }
/** * equals. * * @param \ClickNow\Money\Currency $currency * * @return bool */ public function equals(self $currency) { return $this->getCurrency() === $currency->getCurrency(); }