Exemple #1
0
 /**
  * Returns a string representation
  *
  * @return string
  */
 public function toString()
 {
     return parent::getValue() . ' ' . self::$_UNITS[parent::getType()][1];
 }
Exemple #2
0
 /**
  * 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);
 }