コード例 #1
0
ファイル: CurrencyHelper.php プロジェクト: vikey89/Sylius
 /**
  * Convert amount and format it!
  *
  * @param int         $amount
  * @param string|null $currency
  * @param bool        $decimal
  *
  * @return string
  */
 public function convertAndFormatAmount($amount, $currency = null, $decimal = false)
 {
     $currency = $currency ?: $this->currencyContext->getCurrency();
     $amount = $this->converter->convertFromBase($amount, $currency);
     return $this->moneyHelper->formatAmount($amount, $currency, $decimal);
 }
コード例 #2
0
ファイル: MoneyHelper.php プロジェクト: Strontium-90/Sylius
 /**
  * @param LocaleContextInterface   $localeContext   The locale context
  * @param CurrencyContextInterface $currencyContext The currency context
  */
 public function __construct(LocaleContextInterface $localeContext, CurrencyContextInterface $currencyContext)
 {
     $this->localeContext = $localeContext;
     parent::__construct($this->getDefaultLocale(), $currencyContext);
 }