當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Zend_Currency::setService方法代碼示例

本文整理匯總了PHP中Zend_Currency::setService方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_Currency::setService方法的具體用法?PHP Zend_Currency::setService怎麽用?PHP Zend_Currency::setService使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Zend_Currency的用法示例。


在下文中一共展示了Zend_Currency::setService方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: setCurrency

 /**
  * @param mixed $currency
  */
 public function setCurrency($price, $userCurrencyId = null)
 {
     $cy = new Application_Model_CurrencyMapper();
     $currency_id = $cy->getDefaultCurrency()->id;
     $code = $cy->find($currency_id)->code;
     $currency = null;
     if ($userCurrencyId) {
         $userCode = $cy->find($userCurrencyId)->code;
         $currency = new Zend_Currency(array('value' => 1, 'currency' => $userCode, 'display' => Zend_Currency::USE_SHORTNAME, 'position' => Zend_Currency::RIGHT, 'format' => '#0.# '));
         $exService = new My_Class_ExchangeService();
         $currency->setService($exService);
         $currency->setValue($price, $code);
     } else {
         $currency = new Zend_Currency(array('value' => $price, 'currency' => $code, 'display' => Zend_Currency::USE_SHORTNAME, 'position' => Zend_Currency::RIGHT, 'format' => '#0.# '));
     }
     $this->currency = $currency;
 }
開發者ID:cioionut,項目名稱:products-webEcommerce,代碼行數:20,代碼來源:Product.php

示例2: testSetService

 /**
  * @group ZF-10751
  */
 public function testSetService()
 {
     $currency = new Zend_Currency();
     $currency->setService('Zend_Currency_Service');
     $this->assertTrue($currency->getService() instanceof Zend_Currency_Service);
 }
開發者ID:ThorstenSuckow,項目名稱:conjoon,代碼行數:9,代碼來源:CurrencyTest.php

示例3: testSetValueWithoutLocale

 /**
  * @ZF-9519
  */
 public function testSetValueWithoutLocale()
 {
     $currency = new Zend_Currency('RUB', 'ru_RU');
     require_once 'Currency/ExchangeTest.php';
     $this->assertEquals(null, $currency->getService());
     $currency->setService(new ExchangeTest());
     $this->assertTrue($currency->getService() instanceof Zend_Currency_CurrencyInterface);
     $currency->setValue(100, 'USD');
     $this->assertEquals(50, $currency->getValue());
     $this->assertEquals('RUB', $currency->getShortName());
 }
開發者ID:travisj,項目名稱:zf,代碼行數:14,代碼來源:CurrencyTest.php

示例4: testExchangeValues

 /**
  * Exchange tests
  */
 public function testExchangeValues()
 {
     $currency = new Zend_Currency(array('currency' => 'EUR', 'locale' => 'de_AT', 'value' => 100));
     $currency2 = new Zend_Currency(array('currency' => 'EUR', 'locale' => 'de_AT', 'value' => 100));
     require_once 'Currency/ExchangeTest.php';
     $this->assertEquals(null, $currency->getService());
     $currency->setService(new ExchangeTest());
     $this->assertTrue($currency->getService() instanceof Zend_Currency_CurrencyInterface);
     $currency->setService('ExchangeTest');
     $this->assertTrue($currency->getService() instanceof Zend_Currency_CurrencyInterface);
 }
開發者ID:vicfryzel,項目名稱:zf,代碼行數:14,代碼來源:CurrencyTest.php


注:本文中的Zend_Currency::setService方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。