25 #require_once 'Zend/Locale.php'; 30 #require_once 'Zend/Locale/Math.php'; 35 #require_once 'Zend/Locale/Format.php'; 91 $type = $this->_units[
'STANDARD'];
94 if (isset($this->_units[
$type]) ===
false) {
95 #require_once 'Zend/Measure/Exception.php'; 119 public function setLocale($locale =
null, $check =
false)
121 if (empty($locale)) {
122 #require_once 'Zend/Registry.php'; 128 if ($locale ===
null) {
134 #require_once 'Zend/Measure/Exception.php'; 142 $this->_locale = (string) $locale;
155 public function getValue($round = -1, $locale =
null)
163 if ($locale !==
null) {
187 if ($locale ===
null) {
192 if (
$type ===
null) {
193 $type = $this->_units[
'STANDARD'];
196 if (empty($this->_units[
$type])) {
197 #require_once 'Zend/Measure/Exception.php'; 203 }
catch(Exception $e) {
204 #require_once 'Zend/Measure/Exception.php'; 232 if (empty($this->_units[
$type])) {
233 #require_once 'Zend/Measure/Exception.php'; 237 if (empty($this->_type)) {
238 $this->_type =
$type;
242 if (is_array($this->_units[$this->
getType()][0])) {
243 foreach ($this->_units[$this->
getType()][0] as $key => $found) {
266 if (is_array($this->_units[
$type][0])) {
267 foreach (array_reverse($this->_units[
$type][0]) as $key => $found) {
289 $slength = strlen(
$value);
291 for(
$i = 1;
$i <= $slength; ++
$i) {
299 $this->_type =
$type;
312 if ((
string) $object == $this->
toString()) {
326 public function toString($round = -1, $locale =
null)
328 if ($locale ===
null) {
332 return $this->
getValue($round, $locale) .
' ' . $this->_units[$this->
getType()][1];
366 return $this->
toString($round, $locale);
375 public function add($object)
377 $object->setType($this->
getType());
390 public function sub($object)
392 $object->setType($this->
getType());
407 $object->setType($this->
getType());
setLocale($locale=null, $check=false)
toString($round=-1, $locale=null)
call_user_func($callable, $param)
static isRegistered($index)
static isLocale($locale, $strict=false, $compatible=true)
getValue($round=-1, $locale=null)
__construct($value, $type=null, $locale=null)
convertTo($type, $round=2, $locale=null)
setValue($value, $type=null, $locale=null)
static round($op1, $precision=0)