示例#1
0
 /**
  * Reduces the supplied monetary object into a single
  * Money object of the supplied currency.
  *
  * @param \Dough\Money\MoneyInterface $source
  * @param string|null $toCurrency
  *
  * @return Money
  *
  * @throws \Dough\Exception\InvalidCurrencyException when a supplied currency is
  *         unknown.
  */
 public function reduce(MoneyInterface $source, $toCurrency = null)
 {
     if (null === $toCurrency) {
         $toCurrency = $this->getBaseCurrency();
     }
     $this->checkCurrencies($toCurrency);
     return $source->reduce($this, $toCurrency);
 }
示例#2
0
文件: Bank.php 项目: merk/dough
 /**
  * Reduces the supplied monetary object into a single
  * Money object.
  *
  * @param \Dough\Money\MoneyInterface $source
  *
  * @return \Dough\Money\Money
  */
 public function reduce(MoneyInterface $source)
 {
     return $source->reduce($this);
 }
示例#3
0
文件: BaseMoney.php 项目: merk/dough
 /**
  * Subtracts the subtrahend from the money object.
  *
  * The subtrahend should be passed in as a positive value.
  *
  * @param MoneyInterface $subtrahend
  * @return Sum
  */
 public function subtract(MoneyInterface $subtrahend)
 {
     return $this->plus($subtrahend->times(-1));
 }