当前位置: 首页>>代码示例>>PHP>>正文


PHP Currency::equals方法代码示例

本文整理汇总了PHP中Currency::equals方法的典型用法代码示例。如果您正苦于以下问题:PHP Currency::equals方法的具体用法?PHP Currency::equals怎么用?PHP Currency::equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Currency的用法示例。


在下文中一共展示了Currency::equals方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: add

 /**
  * @param money $amount
  * @return money
  */
 public function add(Money $amount)
 {
     if (!$this->currency->equals($amount->getCurrency())) {
         throw new \InvalidArgumentException('Currency mismatch');
     }
     return new Money($this->currency, $this->amount + $amount->getValue());
 }
开发者ID:rocketpastsix,项目名称:OOPExample,代码行数:11,代码来源:money.php

示例2: isSameCurrency

 /**
  * Checks whether a Money has the same Currency as this.
  *
  * @param Money $other
  *
  * @return bool
  */
 public function isSameCurrency(Money $other)
 {
     return $this->currency->equals($other->currency);
 }
开发者ID:barryvdh,项目名称:money,代码行数:11,代码来源:Money.php

示例3: equals

 /**
  * Checks if an other CurrencyPair has the same parameters as this.
  *
  * @param CurrencyPair $other
  *
  * @return bool
  */
 public function equals(CurrencyPair $other)
 {
     return $this->baseCurrency->equals($other->baseCurrency) && $this->counterCurrency->equals($other->counterCurrency) && $this->conversionRatio === $other->conversionRatio;
 }
开发者ID:barryvdh,项目名称:money,代码行数:11,代码来源:CurrencyPair.php

示例4: ensureCurrenciesMatch

 private function ensureCurrenciesMatch(Currency $myCurrency, Currency $yourCurrency)
 {
     if (!$myCurrency->equals($yourCurrency)) {
         throw new \InvalidArgumentException('Currency mismatch');
     }
 }
开发者ID:mihaeu,项目名称:PW-SimpleShop,代码行数:6,代码来源:Money.php

示例5: testCanCompareDifferentCurrencies

 public function testCanCompareDifferentCurrencies()
 {
     $eur = new Currency('EUR');
     $this->assertFalse($eur->equals($this->createUsd()));
 }
开发者ID:mihaeu,项目名称:PW-SimpleShop,代码行数:5,代码来源:CurrencyTest.php

示例6: isSameCurrencyAs

 /**
  * @param Money $money
  * @return bool
  */
 public function isSameCurrencyAs(Money $money)
 {
     return $this->currency->equals($money->getCurrency());
 }
开发者ID:superbalist,项目名称:php-money,代码行数:8,代码来源:Money.php


注:本文中的Currency::equals方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。