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

Public Member Functions

 __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.
 

Protected Attributes

 $_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 = null,
  $locale = null 
)

Zend_Measure_Abstract is an abstract class for the different measurement types.

Parameters
mixed$valueValue as string, integer, real or float
int$typeOPTIONAL a measure type f.e. Zend_Measure_Length::METER
Zend_Locale$localeOPTIONAL a Zend_Locale Type
Exceptions
Zend_Measure_Exception

Member Function Documentation

__toString ( )

Returns a string representation.

Returns
string
add (   $object)

Adds an unit to another one.

Parameters
Zend_Measure_Abstract$objectobject of same unit type
Returns
Zend_Measure_Abstract
compare (   $object)

Compares two units.

Parameters
Zend_Measure_Abstract$objectobject of same unit type
Returns
boolean
convertTo (   $type,
  $round = 2,
  $locale = null 
)

Alias function for setType returning the converted unit.

Parameters
string$typeConstant Type
integer$round(Optional) Rounds the value to a given precision
string | Zend_Locale$locale(Optional) Locale to set for the number
Returns
string
equals (   $object)

Compare if the value and type is equal.

Parameters
Zend_Measure_Abstract$objectobject to compare
Returns
boolean
getConversionList ( )

Returns the conversion list.

Returns
array
getLocale ( )

Returns the actual set locale.

Returns
string
getType ( )

Returns the original type.

Returns
type
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
setLocale (   $locale = null,
  $check = false 
)

Sets a new locale for the value representation.

Parameters
string | Zend_Locale$locale(Optional) New locale to set
boolean$checkFalse, check but don't set; True, set the new locale
Returns
Zend_Measure_Abstract
setType (   $type)

Set a new type, and convert the value.

Parameters
string$typeNew type to set
Exceptions
Zend_Measure_Exception
Returns
Zend_Measure_Abstract
setValue (   $value,
  $type = null,
  $locale = null 
)

Set a new value.

Parameters
integer | string$valueValue as string, integer, real or float
string$typeOPTIONAL A measure type f.e. Zend_Measure_Length::METER
string | Zend_Locale$localeOPTIONAL Locale for parsing numbers
Exceptions
Zend_Measure_Exception
Returns
Zend_Measure_Abstract
sub (   $object)

Substracts an unit from another one.

Parameters
Zend_Measure_Abstract$objectobject of same unit type
Returns
Zend_Measure_Abstract
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

Member Data Documentation

string $_locale = null
protected

Locale identifier.

string $_type
protected

Original type for this unit.

$_units = array()
protected

Unit types for this measurement.

string $_value
protected

Plain value in standard unit.