Beispiel #1
0
 /**
  * {@inheritDoc}
  *
  * @throws Exception\InvalidArgumentException If $money's currency is not equal to the currency to exchange from
  */
 public function exchange(Money $money, $roundingMode = Money::ROUND_HALF_UP)
 {
     if ($money->getCurrency() != $this->getFromCurrency()) {
         throw new Exception\InvalidArgumentException('The Money has the wrong currency');
     }
     return $money->exchange($this->getToCurrency(), $this->getExchangeRate(), $roundingMode);
 }
Beispiel #2
0
 /**
  * {@inheritDoc}
  *
  * @todo
  */
 public function exchange(Money $money, $targetCurrency)
 {
     if (is_string($targetCurrency)) {
         $targetCurrency = Currency::create($targetCurrency);
     }
     $exchangeRate = 0;
     return $money->exchange($targetCurrency, $exchangeRate);
 }