示例#1
0
 public function assertSameCurrency(MoneyInterface $rightHandValue)
 {
     if (!$this->isSameCurrency($rightHandValue)) {
         $msg = "Different currencies provided: Money object of Currency type %s with precision %n and display precision %n expected.";
         throw new InvalidArgumentException(sprintf($msg, $this->currency->getCurrencyCode(), $this->currency->getPrecision(), $this->currency->getDisplayPrecision()));
     }
 }
示例#2
0
 /**
  * {inheritDoc}
  */
 public function equals(CurrencyInterface $currency)
 {
     return $this->currencyCode === $currency->getCurrencyCode() && $this->precision === $currency->getPrecision() && $this->displayPrecision === $currency->getDisplayPrecision();
 }
示例#3
0
 /**
  * Compares currency codes as plain strings, ignoring precision
  *
  * @param \Matmar10\Money\Entity\CurrencyInterface $currency The currency pair to check against
  * @param \Matmar10\Money\Entity\CurrencyInterface $compareToCurrency The currency pair to check against
  * @return boolean
  */
 static function currencyCodesMatch(CurrencyInterface $currency, CurrencyInterface $compareToCurrency)
 {
     return $currency->getCurrencyCode() === $compareToCurrency->getCurrencyCode();
 }