public function format($number, $decimals = null, $decPoint = null, $thousandsSep = null, $symbol = null) { $number = parent::format($number, $decimals, $decPoint, $thousandsSep); if ($symbol !== null) { $number = $number . ' ' . $symbol; } return $number; }
/** * @since 2.3 * @param float $number * @param int $decimals * @param string $decPoint * @param string $thousandsSep * @param int|null $currencyId * @return string */ public function formatByCurrency($number, $decimals = null, $decPoint = null, $thousandsSep = null, $currencyId = null) { $number = parent::format($number, $decimals, $decPoint, $thousandsSep); $currency = $currencyId !== null ? CurrencyQuery::create()->findPk($currencyId) : $this->request->getSession()->getCurrency(); if ($currency !== null && strpos($currency->getFormat(), '%n') !== false) { return str_replace(['%n', '%s', '%c'], [$number, $currency->getSymbol(), $currency->getCode()], $currency->getFormat()); } return $number; }