eZ Publish  [trunk]
eZCurrency Class Reference

Locale aware currency class. More...

List of all members.

Public Member Functions

 adjustValue ($old_scale, $new_scale)
 eZCurrency ($value)
 locale ()
 name ()
 setLocale (&$locale)
 setValue ($value)
 shortName ()
 symbol ()
 toString ()
 value ()

Public Attributes

 $Locale
 The current locale object.
 $Value
 The currency value.

Detailed Description

Locale aware currency class.

eZCurrency handles currency values and allows for easy output with toString() and conversion with adjustValue().

A new instance of eZCurrency will automaticly use the current locale, if you however want a different locale use the setLocale() function. The current locale can be fetched with locale().

Change the currency value with setValue() or convert it to a new currency type with adjustValue() and setLocale(). If you want more detiled information on the currency use type(), name() and shortName().

Text output is done with toString() which returns a representation according to the current locale.

See also:
eZLocale

Definition at line 32 of file ezcurrency.php.


Member Function Documentation

eZCurrency::adjustValue ( old_scale,
new_scale 
)

Adjust the value so that it can be represented in a different currency. The $old_scale is a float value which represents the current currency rate while $new_scale represents the new currency rate. All rates should be calculated from the dollar which then gets the rate 1.0.

Definition at line 62 of file ezcurrency.php.

eZCurrency::eZCurrency ( value)

Creates a new eZCurrency object with the currency value $value. $value can be a numerical value or an eZCurrency object in which case the value is extracted and copied.

Definition at line 38 of file ezcurrency.php.

Returns a reference to the current locale.

Definition at line 78 of file ezcurrency.php.

Returns the name of the currency, for instance Norwegian Kroner or US dollar.

Definition at line 102 of file ezcurrency.php.

eZCurrency::setLocale ( &$  locale)

Sets the locale to $locale which is used in text output.

Definition at line 51 of file ezcurrency.php.

eZCurrency::setValue ( value)

Sets the currency value to $value.

Definition at line 70 of file ezcurrency.php.

Returns a 3 letter name for the currency, for instance NOK or USD.

Definition at line 110 of file ezcurrency.php.

Returns the currency symbol, for instance kr for NOK or $ for USD.

Definition at line 94 of file ezcurrency.php.

Returns a text representation of the currency according to the current locale.

Definition at line 118 of file ezcurrency.php.

Returns the currency value.

Definition at line 86 of file ezcurrency.php.


Member Data Documentation

eZCurrency::$Locale

The current locale object.

Definition at line 126 of file ezcurrency.php.

eZCurrency::$Value

The currency value.

Definition at line 124 of file ezcurrency.php.


The documentation for this class was generated from the following file: