Definition at line 46 of file Abstract.php.
◆ __construct()
__construct |
( |
|
$value, |
|
|
|
$type = null , |
|
|
|
$locale = null |
|
) |
| |
Zend_Measure_Abstract is an abstract class for the different measurement types
- Parameters
-
- Exceptions
-
Definition at line 82 of file Abstract.php.
91 $type = $this->_units[
'STANDARD'];
94 if (isset($this->_units[
$type]) ===
false) {
95 #require_once 'Zend/Measure/Exception.php'; setLocale($locale=null, $check=false)
static isLocale($locale, $strict=false, $compatible=true)
setValue($value, $type=null, $locale=null)
◆ __toString()
Returns a string representation
- Returns
- string
Definition at line 340 of file Abstract.php.
toString($round=-1, $locale=null)
◆ add()
Adds an unit to another one
- Parameters
-
- Returns
- Zend_Measure_Abstract
Definition at line 375 of file Abstract.php.
377 $object->setType($this->
getType());
getValue($round=-1, $locale=null)
setValue($value, $type=null, $locale=null)
◆ compare()
Compares two units
- Parameters
-
- Returns
- boolean
Definition at line 405 of file Abstract.php.
407 $object->setType($this->
getType());
getValue($round=-1, $locale=null)
◆ convertTo()
convertTo |
( |
|
$type, |
|
|
|
$round = 2 , |
|
|
|
$locale = null |
|
) |
| |
Alias function for setType returning the converted unit
- Parameters
-
string | $type | Constant Type |
integer | $round | (Optional) Rounds the value to a given precision |
string | Zend_Locale | $locale | (Optional) Locale to set for the number |
- Returns
- string
Definition at line 363 of file Abstract.php.
366 return $this->
toString($round, $locale);
toString($round=-1, $locale=null)
◆ equals()
Compare if the value and type is equal
- Parameters
-
- Returns
- boolean
Definition at line 310 of file Abstract.php.
312 if ((
string) $object == $this->
toString()) {
toString($round=-1, $locale=null)
◆ getConversionList()
Returns the conversion list
- Returns
- array
Definition at line 350 of file Abstract.php.
◆ getLocale()
Returns the actual set locale
- Returns
- string
Definition at line 107 of file Abstract.php.
◆ getType()
Returns the original type
- Returns
- type
Definition at line 218 of file Abstract.php.
◆ getValue()
getValue |
( |
|
$round = -1 , |
|
|
|
$locale = null |
|
) |
| |
Returns the internal value
- Parameters
-
integer | $round | (Optional) Rounds the value to an given precision, Default is -1 which returns without rounding |
string | Zend_Locale | $locale | (Optional) Locale for number representation |
- Returns
- integer|string
Definition at line 155 of file Abstract.php.
163 if ($locale !==
null) {
setLocale($locale=null, $check=false)
static round($op1, $precision=0)
◆ setLocale()
setLocale |
( |
|
$locale = null , |
|
|
|
$check = false |
|
) |
| |
Sets a new locale for the value representation
- Parameters
-
string | Zend_Locale | $locale | (Optional) New locale to set |
boolean | $check | False, check but don't set; True, set the new locale |
- Returns
- Zend_Measure_Abstract
Definition at line 119 of file Abstract.php.
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;
static isRegistered($index)
static isLocale($locale, $strict=false, $compatible=true)
◆ setType()
Set a new type, and convert the value
- Parameters
-
string | $type | New type to set |
- Exceptions
-
- Returns
- Zend_Measure_Abstract
Definition at line 230 of file Abstract.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;
call_user_func($callable, $param)
static round($op1, $precision=0)
◆ setValue()
setValue |
( |
|
$value, |
|
|
|
$type = null , |
|
|
|
$locale = null |
|
) |
| |
Set a new value
- Parameters
-
integer | string | $value | Value as string, integer, real or float |
string | $type | OPTIONAL A measure type f.e. Zend_Measure_Length::METER |
string | Zend_Locale | $locale | OPTIONAL Locale for parsing numbers |
- Exceptions
-
- Returns
- Zend_Measure_Abstract
Definition at line 180 of file Abstract.php.
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'; setLocale($locale=null, $check=false)
static isLocale($locale, $strict=false, $compatible=true)
◆ sub()
Substracts an unit from another one
- Parameters
-
- Returns
- Zend_Measure_Abstract
Definition at line 390 of file Abstract.php.
392 $object->setType($this->
getType());
getValue($round=-1, $locale=null)
setValue($value, $type=null, $locale=null)
◆ toString()
toString |
( |
|
$round = -1 , |
|
|
|
$locale = null |
|
) |
| |
Returns a string representation
- Parameters
-
integer | $round | (Optional) Runds the value to an given exception |
string | Zend_Locale | $locale | (Optional) Locale to set for the number |
- Returns
- string
Definition at line 326 of file Abstract.php.
328 if ($locale ===
null) {
332 return $this->
getValue($round, $locale) .
' ' . $this->_units[$this->
getType()][1];
getValue($round=-1, $locale=null)
◆ $_locale
◆ $_type
Original type for this unit
Definition at line 60 of file Abstract.php.
◆ $_units
Unit types for this measurement
Definition at line 72 of file Abstract.php.
◆ $_value
Plain value in standard unit
Definition at line 53 of file Abstract.php.
The documentation for this class was generated from the following file:
- vendor/magento/zendframework1/library/Zend/Measure/Abstract.php