Exponential 6.0.13 Exponential Enterprise Open Source CMS - PHP Class Reference

Public Member Functions | Public Attributes | List of all members
eZCurrency Class Reference
Locale system

Locale aware currency class. More...

## Public Member Functions
| __construct ( $value)
| setLocale (&$locale)
| adjustValue ( $old_scale, $new_scale)
| setValue ( $value)
| locale ()
| value ()
| symbol ()
| name ()
| shortName ()
| toString ()

## Public Attributes
| $Value
| The currency value. More...
| $Locale
| The current locale object. More...

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

## Constructor & Destructor Documentation

## ◆ __construct()

eZCurrency::__construct | ( |  | $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.

Parameters

  eZCurrency | number | $value |

Definition at line 40 of file ezcurrency.php.

References eZLocale\instance().

## Member Function Documentation

## ◆ adjustValue()

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 64 of file ezcurrency.php.

## ◆ locale()

eZCurrency::locale | ( |  | ) |

Returns a reference to the current locale.

Definition at line 80 of file ezcurrency.php.

References $Locale.

## ◆ name()

eZCurrency::name | ( |  | ) |

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

Definition at line 104 of file ezcurrency.php.

## ◆ setLocale()

eZCurrency::setLocale | ( | & | $locale | ) |

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

Definition at line 53 of file ezcurrency.php.

## ◆ setValue()

eZCurrency::setValue | ( |  | $value | ) |

Sets the currency value to $value.

Definition at line 72 of file ezcurrency.php.

## ◆ shortName()

eZCurrency::shortName | ( |  | ) |

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

Definition at line 112 of file ezcurrency.php.

## ◆ symbol()

eZCurrency::symbol | ( |  | ) |

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

Definition at line 96 of file ezcurrency.php.

## ◆ toString()

eZCurrency::toString | ( |  | ) |

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

Definition at line 120 of file ezcurrency.php.

## ◆ value()

eZCurrency::value | ( |  | ) |

Returns the currency value.

Definition at line 88 of file ezcurrency.php.

References $Value.

## Member Data Documentation

## ◆ $Locale

eZCurrency::$Locale

The current locale object.

Definition at line 128 of file ezcurrency.php.

Referenced by locale().

## ◆ $Value

eZCurrency::$Value

The currency value.

Definition at line 126 of file ezcurrency.php.

Referenced by value().

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

- ezcurrency.php

Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.