Currency.php
Zend Framework
LICENSE
This source file is subject to the new BSD license that is bundled
with this package in the file LICENSE.txt.
It is also available through the world-wide-web at this URL:
http://framework.zend.com/license/new-bsd
If you did not receive a copy of the license and are unable to
obtain it through the world-wide-web, please send an email
to license@zend.com so we can send you a copy immediately.
- category
- Zend
- copyright
- Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- license
-
New BSD License
- package
- Zend_Currency
- version
- $Id: Currency.php 23775 2011-03-01 17:25:24Z ralph $
Class for handling currency notations
- category
- Zend
- copyright
- Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- license
-
New BSD License
- package
- Zend_Currency
Constants
Properties
Methods



__construct(
string|array $options
=
null, string|\Zend_Locale $locale
=
null
)
:
void
Creates a currency instance. Every supressed parameter is used from the actual or the given locale.
Parameters
Name |
Type |
Description |
$options |
string|array |
OPTIONAL Options array or currency short name when string is given |
$locale |
string|\Zend_Locale
|
OPTIONAL locale name |
Throws



_checkOptions(
array $options
=
array
)
:
array
Internal method for checking the options array
Parameters
Name |
Type |
Description |
$options |
array |
Options to check |
Returns
Throws



_checkParams(
string $currency
=
null, string|\Zend_Locale $locale
=
null
)
:
string
Internal function for checking static given locale parameter
Parameters
Name |
Type |
Description |
$currency |
string |
(Optional) Currency name
|
$locale |
string|\Zend_Locale
|
(Optional) Locale to display informations
|
Returns
Type |
Description |
string |
The extracted locale representation as string |
Throws



_exchangeCurrency(
float|integer|\Zend_Currency $value, string|\Zend_Currency $currency
)
:
\unknown
Internal method which calculates the exchanges currency
Parameters
Name |
Type |
Description |
$value |
float|integer|\Zend_Currency
|
Compares the currency with this value |
$currency |
string|\Zend_Currency
|
The currency to compare this value from |
Returns
Type |
Description |
\unknown |
|



_extractPattern(
string $pattern, float|integer $value
)
:
string
Internal method to extract the currency pattern
when a choice is given based on the given value
Parameters
Name |
Type |
Description |
$pattern |
string |
|
$value |
float|integer |
|
Returns



clearCache(
string $tag
=
null
)
:
void
staticClears all set cache data
Parameters
Name |
Type |
Description |
$tag |
string |
Tag to clear when the default tag name is not used |



equals(
float|integer|\Zend_Currency $value, string|\Zend_Currency $currency
=
null
)
:
boolean
Returns true when the two currencies are equal
Parameters
Name |
Type |
Description |
$value |
float|integer|\Zend_Currency
|
Compares the currency with this value |
$currency |
string|\Zend_Currency
|
The currency to compare this value from |
Returns



getCurrencyList(
string $region
=
null
)
:
array
Returns a list of currencies which are used in this region
a region name should be 2 charachters only (f.e. EG, DE, US)
If no region is given, the actual region is used
Parameters
Name |
Type |
Description |
$region |
string |
OPTIONAL Region to return the currencies for |
Returns
Type |
Description |
array |
List of currencies |



getName(
string $currency
=
null, string|\Zend_Locale $locale
=
null
)
:
string
Returns the actual or details of other currency names
Parameters
Name |
Type |
Description |
$currency |
string |
(Optional) Currency's short name
|
$locale |
string|\Zend_Locale
|
(Optional) The locale
|
Returns



getRegionList(
string $currency
=
null
)
:
array
Returns a list of regions where this currency is or was known
Parameters
Name |
Type |
Description |
$currency |
string |
OPTIONAL Currency's short name
|
Returns
Type |
Description |
array |
List of regions |
Throws



getService(
)
:
\Zend_Service
Returns the set service class
Returns
Type |
Description |
\Zend_Service |
|



getShortName(
string $currency
=
null, string|\Zend_Locale $locale
=
null
)
:
string
Returns the actual or details of other currency shortnames
Parameters
Name |
Type |
Description |
$currency |
string |
OPTIONAL Currency's name
|
$locale |
string|\Zend_Locale
|
OPTIONAL The locale |
Returns



getSymbol(
string $currency
=
null, string|\Zend_Locale $locale
=
null
)
:
string
Returns the actual or details of other currency symbols,
when no symbol is available it returns the currency shortname (f.e. FIM for Finnian Mark)
Parameters
Name |
Type |
Description |
$currency |
string |
(Optional) Currency name
|
$locale |
string|\Zend_Locale
|
(Optional) Locale to display informations
|
Returns



isLess(
float|integer|\Zend_Currency $value, string|\Zend_Currency $currency
=
null
)
:
boolean
Returns true when the currency is less than the given value
Parameters
Name |
Type |
Description |
$value |
float|integer|\Zend_Currency
|
Compares the currency with this value |
$currency |
string|\Zend_Currency
|
The currency to compare this value from |
Returns



isMore(
float|integer|\Zend_Currency $value, string|\Zend_Currency $currency
=
null
)
:
boolean
Returns true when the currency is more than the given value
Parameters
Name |
Type |
Description |
$value |
float|integer|\Zend_Currency
|
Compares the currency with this value |
$currency |
string|\Zend_Currency
|
The currency to compare this value from |
Returns



setFormat(
array $options
=
array
)
:
\Zend_Currency
Sets the formating options of the localized currency string
If no parameter is passed, the standard setting of the
actual set locale will be used
Parameters
Name |
Type |
Description |
$options |
array |
(Optional) Options to set
|
Returns



setLocale(
string|\Zend_Locale $locale
=
null
)
:
\Zend_Currency
Sets a new locale for data retreivement
Example: 'de_XX' will be set to 'de' because 'de_XX' does not exist
'xx_YY' will be set to 'root' because 'xx' does not exist
Parameters
Name |
Type |
Description |
$locale |
string|\Zend_Locale
|
(Optional) Locale for parsing input
|
Returns
Throws



toCurrency(
integer|float $value
=
null, array $options
=
array
)
:
string
Returns a localized currency string
Parameters
Name |
Type |
Description |
$value |
integer|float |
OPTIONAL Currency value |
$options |
array |
OPTIONAL options to set temporary |
Returns
Throws