Exemplo n.º 1
0
 /**
  * localized format for money with the NumberFormatter class in Currency mode
  * with currency symbol
  * like €1.234,56
  *
  * @param Money $money
  * @param null  $locale
  * @return bool|string
  */
 public function formatI18n(Money $money, $locale = null)
 {
     if ($locale === null) {
         $locale = $this->locale;
     }
     $formatter = new \NumberFormatter($locale, \NumberFormatter::CURRENCY);
     return $formatter->formatCurrency($money->getConvertedAmount(), $money->getCurrency()->getCurrencyCode());
 }
Exemplo n.º 2
0
 /**
  * Formats a Money object using PHP's built-in NumberFormatter.
  *
  * @param  \SebastianBergmann\Money\Money $money
  * @return string
  */
 public function format(Money $money)
 {
     return $this->numberFormatter->formatCurrency($money->getConvertedAmount(), $money->getCurrency()->getCurrencyCode());
 }
Exemplo n.º 3
0
 /**
  * Gets the monetary value represented by this object converted to its base
  * units
  *
  * @return float
  */
 public function getConvertedAmount()
 {
     return $this->wrappedMoney->getConvertedAmount();
 }
Exemplo n.º 4
0
 /**
  * {@inheritdoc}
  */
 public function getConvertedAmount()
 {
     return $this->valueObject->getConvertedAmount();
 }