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


PHP Zend_Currency::equals方法代码示例

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


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

示例1: getNoOfSharersAllowed

 /**
  * Gets the number of sharers allowed.
  *
  * Method which returns the number of sharers that are permitted
  * given a specified cover amount.
  *
  * @param Zend_Currency $coverAmount
  * The main cover amount on the TCI+ policy.
  *
  * @return integer
  * Returns the number of sharers allowed on the $coverAmount given.
  */
 public function getNoOfSharersAllowed($coverAmount)
 {
     $params = Zend_Registry::get('params');
     //Read in the lower contents bands.
     $bandLower = array();
     $bandLower[] = new Zend_Currency(array('value' => $params->sharers->band0->lower, 'precision' => 0));
     $bandLower[] = new Zend_Currency(array('value' => $params->sharers->band1->lower, 'precision' => 0));
     $bandLower[] = new Zend_Currency(array('value' => $params->sharers->band2->lower, 'precision' => 0));
     $bandLower[] = new Zend_Currency(array('value' => $params->sharers->band3->lower, 'precision' => 0));
     //Read in the upper contents bands.
     $bandUpper = array();
     $bandUpper[] = new Zend_Currency(array('value' => $params->sharers->band0->upper, 'precision' => 0));
     $bandUpper[] = new Zend_Currency(array('value' => $params->sharers->band1->upper, 'precision' => 0));
     $bandUpper[] = new Zend_Currency(array('value' => $params->sharers->band2->upper, 'precision' => 0));
     $bandUpper[] = new Zend_Currency(array('value' => $params->sharers->band3->upper, 'precision' => 0));
     $numberPermitted = array();
     $numberPermitted[] = $params->sharers->numberPermitted->band0;
     $numberPermitted[] = $params->sharers->numberPermitted->band1;
     $numberPermitted[] = $params->sharers->numberPermitted->band2;
     $numberPermitted[] = $params->sharers->numberPermitted->band3;
     //Zero sharers by default until the cover amount is understood.
     $returnVal = 0;
     for ($i = 0; $i < count($bandLower); $i++) {
         $bandFound = false;
         if ($coverAmount->isMore($bandLower[$i]) && $coverAmount->isLess($bandUpper[$i])) {
             $bandFound = true;
         } else {
             if ($coverAmount->equals($bandLower[$i]) || $coverAmount->equals($bandUpper[$i])) {
                 $bandFound = true;
             }
         }
         if ($bandFound) {
             $returnVal = $numberPermitted[$i];
             break;
         }
     }
     return $returnVal;
 }
开发者ID:AlexEvesDeveloper,项目名称:hl-stuff,代码行数:50,代码来源:Sharers.php

示例2: testEqualsValues

 /**
  * Equals values
  */
 public function testEqualsValues()
 {
     $currency = new Zend_Currency(array('currency' => 'EUR', 'locale' => 'de_AT', 'value' => 100));
     $currency2 = new Zend_Currency(array('currency' => 'EUR', 'locale' => 'de_AT', 'value' => 100));
     $this->assertTrue($currency->equals($currency2));
     $currency3 = new Zend_Currency(array('currency' => 'EUR', 'locale' => 'de_AT', 'value' => 101));
     $this->assertFalse($currency->equals($currency3));
 }
开发者ID:ThorstenSuckow,项目名称:conjoon,代码行数:11,代码来源:CurrencyTest.php


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