Zend Framework  1.12
Public Member Functions | Public Attributes | Protected Attributes | List of all members
Zend_Measure_Number Class Reference

Public Member Functions

 __construct ($value, $type, $locale=null)
 Zend_Measure_Abstract is an abstract class for the different measurement types.
 
 setValue ($value, $type=null, $locale=null)
 Set a new value.
 
 setType ($type)
 Set a new type, and convert the value.
 
 convertTo ($type, $round=0, $locale=null)
 Alias function for setType returning the converted unit Default is 0 as this class only handles numbers without precision.
 
- Public Member Functions inherited from Zend_Measure_Abstract
 __construct ($value, $type=null, $locale=null)
 Zend_Measure_Abstract is an abstract class for the different measurement types.
 
 getLocale ()
 Returns the actual set locale.
 
 setLocale ($locale=null, $check=false)
 Sets a new locale for the value representation.
 
 getValue ($round=-1, $locale=null)
 Returns the internal value.
 
 setValue ($value, $type=null, $locale=null)
 Set a new value.
 
 getType ()
 Returns the original type.
 
 setType ($type)
 Set a new type, and convert the value.
 
 equals ($object)
 Compare if the value and type is equal.
 
 toString ($round=-1, $locale=null)
 Returns a string representation.
 
 __toString ()
 Returns a string representation.
 
 getConversionList ()
 Returns the conversion list.
 
 convertTo ($type, $round=2, $locale=null)
 Alias function for setType returning the converted unit.
 
 add ($object)
 Adds an unit to another one.
 
 sub ($object)
 Substracts an unit from another one.
 
 compare ($object)
 Compares two units.
 

Public Attributes

const STANDARD = 'DECIMAL'
 
const BINARY = 'BINARY'
 
const TERNARY = 'TERNARY'
 
const QUATERNARY = 'QUATERNARY'
 
const QUINARY = 'QUINARY'
 
const SENARY = 'SENARY'
 
const SEPTENARY = 'SEPTENARY'
 
const OCTAL = 'OCTAL'
 
const NONARY = 'NONARY'
 
const DECIMAL = 'DECIMAL'
 
const DUODECIMAL = 'DUODECIMAL'
 
const HEXADECIMAL = 'HEXADECIMAL'
 
const ROMAN = 'ROMAN'
 

Protected Attributes

 $_units
 
- Protected Attributes inherited from Zend_Measure_Abstract
 $_value
 Plain value in standard unit.
 
 $_type
 Original type for this unit.
 
 $_locale = null
 Locale identifier.
 
 $_units = array()
 Unit types for this measurement.
 

Constructor & Destructor Documentation

__construct (   $value,
  $type,
  $locale = null 
)

Zend_Measure_Abstract is an abstract class for the different measurement types.

Parameters
integer$valueValue
string$type(Optional) A Zend_Measure_Number Type
string | Zend_Locale$locale(Optional) A Zend_Locale
Exceptions
Zend_Measure_ExceptionWhen language is unknown
Zend_Measure_ExceptionWhen type is unknown

Member Function Documentation

convertTo (   $type,
  $round = 0,
  $locale = null 
)

Alias function for setType returning the converted unit Default is 0 as this class only handles numbers without precision.

Parameters
string$typeType to convert to
integer$round(Optional) Precision to add, will always be 0
Returns
string
setType (   $type)

Set a new type, and convert the value.

Parameters
string$typeNew type to set
Exceptions
Zend_Measure_ExceptionWhen a unknown type is given
Returns
void
setValue (   $value,
  $type = null,
  $locale = null 
)

Set a new value.

Parameters
integer$valueValue
string$type(Optional) A Zend_Measure_Number Type
string | Zend_Locale$locale(Optional) A Zend_Locale Type
Exceptions
Zend_Measure_Exception

Member Data Documentation

$_units
protected
Initial value:
= array(
'BINARY' => array(2, '⑵'),
'TERNARY' => array(3, '⑶'),
'QUATERNARY' => array(4, '⑷'),
'QUINARY' => array(5, '⑸'),
'SENARY' => array(6, '⑹'),
'SEPTENARY' => array(7, '⑺'),
'OCTAL' => array(8, '⑻'),
'NONARY' => array(9, '⑼'),
'DECIMAL' => array(10, '⑽'),
'DUODECIMAL' => array(12, '⑿'),
'HEXADECIMAL' => array(16, '⒃'),
'ROMAN' => array(99, ''),
'STANDARD' => 'DECIMAL'
)
const BINARY = 'BINARY'
const DECIMAL = 'DECIMAL'
const DUODECIMAL = 'DUODECIMAL'
const HEXADECIMAL = 'HEXADECIMAL'
const NONARY = 'NONARY'
const OCTAL = 'OCTAL'
const QUATERNARY = 'QUATERNARY'
const QUINARY = 'QUINARY'
const ROMAN = 'ROMAN'
const SENARY = 'SENARY'
const SEPTENARY = 'SEPTENARY'
const STANDARD = 'DECIMAL'
const TERNARY = 'TERNARY'