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


PHP Zend_Measure_Abstract::setValue方法代碼示例

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


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

示例1: setType

 /**
  * Set a new type, and convert the value
  *
  * @param $type  new type to set
  * @throws Zend_Measure_Exception
  */
 public function setType($type)
 {
     if (empty(self::$_UNITS[$type])) {
         throw Zend::exception('Zend_Measure_Exception', 'unknown type of number:' . $type);
     }
     $value = $this->toDecimal(parent::getValue(), parent::getType());
     $value = $this->fromDecimal($value, $type);
     parent::setValue($value, $type, $this->_Locale);
     parent::setType($type);
 }
開發者ID:jorgenils,項目名稱:zend-framework,代碼行數:16,代碼來源:Number.php

示例2: setType

 /**
  * Set a new type, and convert the value
  *
  * @param  string  $type  New type to set
  * @throws Zend_Measure_Exception
  */
 public function setType($type)
 {
     if (empty(self::$_UNITS[$type])) {
         throw new Zend_Measure_Exception("type ({$type}) is a unknown flow mass");
     }
     // Convert to standard value
     $value = parent::getValue();
     if (is_array(self::$_UNITS[parent::getType()][0])) {
         foreach (self::$_UNITS[parent::getType()][0] as $key => $found) {
             switch ($key) {
                 case "/":
                     $value /= $found;
                     break;
                 default:
                     $value *= $found;
                     break;
             }
         }
     } else {
         $value = $value * self::$_UNITS[parent::getType()][0];
     }
     // Convert to expected value
     if (is_array(self::$_UNITS[$type][0])) {
         foreach (self::$_UNITS[$type][0] as $key => $found) {
             switch ($key) {
                 case "/":
                     $value *= $found;
                     break;
                 default:
                     $value /= $found;
                     break;
             }
         }
     } else {
         $value = $value / self::$_UNITS[$type][0];
     }
     parent::setValue($value, $type, $this->_Locale);
     parent::setType($type);
 }
開發者ID:jorgenils,項目名稱:zend-framework,代碼行數:45,代碼來源:Mass.php

示例3: setType

 /**
  * Set a new type, and convert the value
  *
  * @param  string  $type  New type to set
  * @throws Zend_Measure_Exception
  */
 public function setType($type)
 {
     if (empty(self::$_UNITS[$type])) {
         throw new Zend_Measure_Exception("type ({$type}) is a unknown illumination");
     }
     // Convert to standard value
     $value = parent::getValue();
     $value = $value * self::$_UNITS[parent::getType()][0];
     // Convert to expected value
     $value = $value / self::$_UNITS[$type][0];
     parent::setValue($value, $type, $this->_Locale);
     parent::setType($type);
 }
開發者ID:jorgenils,項目名稱:zend-framework,代碼行數:19,代碼來源:Illumination.php

示例4: setType

 /**
  * Set a new type, and convert the value
  *
  * @param  $type  type to set
  * @throws Zend_Measure_Exception
  */
 public function setType($type)
 {
     if (empty(self::$_UNITS[$type])) {
         self::throwException('unknown type of lightness:' . $type);
     }
     // Convert to standard value
     $value = parent::getValue();
     $value = $value * self::$_UNITS[parent::getType()][0];
     // Convert to expected value
     $value = $value / self::$_UNITS[$type][0];
     parent::setValue($value, $type, $this->_Locale);
     parent::setType($type);
 }
開發者ID:jorgenils,項目名稱:zend-framework,代碼行數:19,代碼來源:Lightness.php

示例5: setType

 /**
  * Set a new type, and convert the value
  *
  * @throws Zend_Measure_Exception
  */
 public function setType($type)
 {
     if (empty(self::$_UNITS[$type])) {
         throw Zend::exception('Zend_Measure_Exception', 'unknown type of force:' . $type);
     }
     // Convert to standard value
     $value = parent::getValue();
     $value = $value * self::$_UNITS[parent::getType()][0];
     // Convert to expected value
     $value = $value / self::$_UNITS[$type][0];
     parent::setValue($value, $type, $this->_Locale);
     parent::setType($type);
 }
開發者ID:jorgenils,項目名稱:zend-framework,代碼行數:18,代碼來源:Force.php

示例6: setType

 /**
  * Set a new type, and convert the value
  *
  * @param $type  new type to set
  * @throws Zend_Measure_Exception
  */
 public function setType($type)
 {
     if (empty(self::$_UNITS[$type])) {
         self::throwException('unknown type of kinematic viscosity:' . $type);
     }
     // Convert to standard value
     $value = parent::getValue();
     if (is_array(self::$_UNITS[parent::getType()][0])) {
         foreach (self::$_UNITS[parent::getType()][0] as $key => $found) {
             switch ($key) {
                 case "/":
                     $value /= $found;
                     break;
                 default:
                     $value *= $found;
                     break;
             }
         }
     } else {
         $value = $value * self::$_UNITS[parent::getType()][0];
     }
     // Convert to expected value
     if (is_array(self::$_UNITS[$type][0])) {
         foreach (self::$_UNITS[$type][0] as $key => $found) {
             switch ($key) {
                 case "/":
                     $value *= $found;
                     break;
                 default:
                     $value /= $found;
                     break;
             }
         }
     } else {
         $value = $value / self::$_UNITS[$type][0];
     }
     parent::setValue($value, $type, $this->_Locale);
     parent::setType($type);
 }
開發者ID:jorgenils,項目名稱:zend-framework,代碼行數:45,代碼來源:Kinematic.php

示例7: setType

 /**
  * Set a new type, and convert the value
  *
  * @param $type  new type to set
  * @throws Zend_Measure_Exception
  */
 public function setType($type)
 {
     if (empty(self::$_UNITS[$type])) {
         self::throwException('unknown type of binary:' . $type);
     }
     // Convert to standard value
     $value = parent::getValue();
     $value = bcmul($value, self::$_UNITS[parent::getType()][0], 25);
     // Convert to expected value
     $value = bcdiv($value, self::$_UNITS[$type][0]);
     parent::setValue($value, $type, $this->_Locale);
     parent::setType($type);
 }
開發者ID:jorgenils,項目名稱:zend-framework,代碼行數:19,代碼來源:Binary.php

示例8: setType

 /**
  * Set a new type, and convert the value
  *
  * @param $type new type to set
  * @throws Zend_Measure_Exception
  */
 public function setType($type)
 {
     if (empty(self::$_UNITS[$type])) {
         throw Zend::exception('Zend_Measure_Exception', 'unknown type of temperature:' . $type);
     }
     // Convert to standard value
     $value = parent::getValue();
     if (is_array(self::$_UNITS[parent::getType()][0])) {
         foreach (self::$_UNITS[parent::getType()][0] as $key => $found) {
             switch ($key) {
                 case "/":
                     $value /= $found;
                     break;
                 case "+":
                     $value += $found;
                     break;
                 case "-":
                     $value -= $found;
                     break;
                 default:
                     $value *= $found;
                     break;
             }
         }
     } else {
         $value = $value * self::$_UNITS[parent::getType()][0];
     }
     // Convert to expected value
     if (is_array(self::$_UNITS[$type][0])) {
         foreach (self::$_UNITS[$type][0] as $key => $found) {
             switch ($key) {
                 case "/":
                     $value *= $found;
                     break;
                 case "+":
                     $value -= $found;
                     break;
                 case "-":
                     $value += $found;
                     break;
                 default:
                     $value /= $found;
                     break;
             }
         }
     } else {
         $value = $value / self::$_UNITS[$type][0];
     }
     parent::setValue($value, $type, $this->_Locale);
     parent::setType($type);
 }
開發者ID:jorgenils,項目名稱:zend-framework,代碼行數:57,代碼來源:Temperature.php

示例9: setType

 /**
  * Set a new type, and convert the value
  *
  * @param  string  $type  New type to set
  * @throws Zend_Measure_Exception
  */
 public function setType($type)
 {
     if (empty(self::$_UNITS[$type])) {
         throw new Zend_Measure_Exception("type ({$type}) is a unknown binary");
     }
     // Convert to standard value
     $value = parent::getValue();
     $value = call_user_func(Zend_Locale_Math::$mul, $value, self::$_UNITS[parent::getType()][0], 25);
     // Convert to expected value
     $value = call_user_func(Zend_Locale_Math::$div, $value, self::$_UNITS[$type][0]);
     parent::setValue($value, $type, $this->_Locale);
     parent::setType($type);
 }
開發者ID:jorgenils,項目名稱:zend-framework,代碼行數:19,代碼來源:Binary.php


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