Currency.php
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_Currency
- Version
- $Id$
\Zend_Currency
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
Constants
Properties

array $_options = array('position' => self::STANDARD, 'script' => null, 'format' => null, 'display' => self::NO_SYMBOL, 'precision' => 2, 'name' => null, 'currency' => null, 'symbol' => null, 'locale' => null, 'value' => 0, 'service' => null, 'tag' => 'Zend_Locale')array('position' => self::STANDARD, 'script' => null, 'format' => null, 'display' => self::NO_SYMBOL, 'precision' => 2, 'name' => null, 'currency' => null, 'symbol' => null, 'locale' => null, 'value' => 0, 'service' => null, 'tag' => 'Zend_Locale')DetailsMethods

__construct(string | array $options = null, string | \Zend_Locale $locale = null) : voidCreates a currency instance. Every supressed parameter is used from the actual or the given locale.
| Name | Type | Description |
|---|---|---|
| $options | string | array | OPTIONAL Options array or currency short name when string is given |
| $locale | string | \Zend_Locale | OPTIONAL locale name |
| Exception | Description |
|---|---|
| \Zend_Currency_Exception | When currency is invalid |

_checkOptions(array $options = array()) : arrayInternal method for checking the options array
| Name | Type | Description |
|---|---|---|
| $options | array | Options to check |
| Type | Description |
|---|---|
| array |
| Exception | Description |
|---|---|
| \Zend_Currency_Exception | On unknown position |
| \Zend_Currency_Exception | On unknown locale |
| \Zend_Currency_Exception | On unknown display |
| \Zend_Currency_Exception | On precision not between -1 and 30 |
| \Zend_Currency_Exception | On problem with script conversion |
| \Zend_Currency_Exception | On unknown options |

_checkParams(string $currency = null, string | \Zend_Locale $locale = null) : stringInternal function for checking static given locale parameter
| Name | Type | Description |
|---|---|---|
| $currency | string | (Optional) Currency name |
| $locale | string | \Zend_Locale | (Optional) Locale to display informations |
| Type | Description |
|---|---|
| string | The extracted locale representation as string |
| Exception | Description |
|---|---|
| \Zend_Currency_Exception | When locale contains no region |

_exchangeCurrency(float | integer | \Zend_Currency $value, string | \Zend_Currency $currency) : \unknownInternal method which calculates the exchanges currency
| 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 |
| Type | Description |
|---|---|
| \unknown |

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

add(float | integer | \Zend_Currency $value, string | \Zend_Currency $currency = null) : \Zend_CurrencyAdds a currency
| Name | Type | Description |
|---|---|---|
| $value | float | integer | \Zend_Currency | Add this value to currency |
| $currency | string | \Zend_Currency | The currency to add |
| Type | Description |
|---|---|
| \Zend_Currency |

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

compare(float | integer | \Zend_Currency $value, string | \Zend_Currency $currency = null) : \Zend_CurrencyCompares two currencies
| 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 |
| Type | Description |
|---|---|
| \Zend_Currency |

div(float | integer | \Zend_Currency $value, string | \Zend_Currency $currency = null) : \Zend_CurrencyDivides a currency
| Name | Type | Description |
|---|---|---|
| $value | float | integer | \Zend_Currency | Divides this value from currency |
| $currency | string | \Zend_Currency | The currency to divide |
| Type | Description |
|---|---|
| \Zend_Currency |

equals(float | integer | \Zend_Currency $value, string | \Zend_Currency $currency = null) : booleanReturns true when the two currencies are equal
| 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 |
| Type | Description |
|---|---|
| boolean |

getCache() : \Zend_Cache_CoreReturns the set cache
| Type | Description |
|---|---|
| \Zend_Cache_Core | The set cache |

getCurrencyList(string $region = null) : arrayReturns 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
| Name | Type | Description |
|---|---|---|
| $region | string | OPTIONAL Region to return the currencies for |
| Type | Description |
|---|---|
| array | List of currencies |

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

getRegionList(string $currency = null) : arrayReturns a list of regions where this currency is or was known
| Name | Type | Description |
|---|---|---|
| $currency | string | OPTIONAL Currency's short name |
| Type | Description |
|---|---|
| array | List of regions |
| Exception | Description |
|---|---|
| \Zend_Currency_Exception | When no currency was defined |

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

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

isLess(float | integer | \Zend_Currency $value, string | \Zend_Currency $currency = null) : booleanReturns true when the currency is less than the given value
| 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 |
| Type | Description |
|---|---|
| boolean |

isMore(float | integer | \Zend_Currency $value, string | \Zend_Currency $currency = null) : booleanReturns true when the currency is more than the given value
| 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 |
| Type | Description |
|---|---|
| boolean |

mod(float | integer | \Zend_Currency $value, string | \Zend_Currency $currency = null) : \Zend_CurrencyCalculates the modulo from a currency
| Name | Type | Description |
|---|---|---|
| $value | float | integer | \Zend_Currency | Calculate modulo from this value |
| $currency | string | \Zend_Currency | The currency to calculate the modulo |
| Type | Description |
|---|---|
| \Zend_Currency |

mul(float | integer | \Zend_Currency $value, string | \Zend_Currency $currency = null) : \Zend_CurrencyMultiplies a currency
| Name | Type | Description |
|---|---|---|
| $value | float | integer | \Zend_Currency | Multiplies this value from currency |
| $currency | string | \Zend_Currency | The currency to multiply |
| Type | Description |
|---|---|
| \Zend_Currency |

setCache(\Zend_Cache_Core $cache) : voidSets a cache for Zend_Currency
| Name | Type | Description |
|---|---|---|
| $cache | \Zend_Cache_Core | Cache to set |

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

setLocale(string | \Zend_Locale $locale = null) : \Zend_CurrencySets 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
| Name | Type | Description |
|---|---|---|
| $locale | string | \Zend_Locale | (Optional) Locale for parsing input |
| Type | Description |
|---|---|
| \Zend_Currency | Provides fluent interface |
| Exception | Description |
|---|---|
| \Zend_Currency_Exception | When the given locale does not exist |

setService(string | \Zend_Currency_CurrencyInterface $service) : \Zend_CurrencySets a new exchange service
| Name | Type | Description |
|---|---|---|
| $service | string | \Zend_Currency_CurrencyInterface | Service class |
| Type | Description |
|---|---|
| \Zend_Currency |

setValue(float | integer | \Zend_Currency $value, string | \Zend_Currency $currency = null) : \Zend_CurrencyAdds a currency
| Name | Type | Description |
|---|---|---|
| $value | float | integer | \Zend_Currency | Add this value to currency |
| $currency | string | \Zend_Currency | The currency to add |
| Type | Description |
|---|---|
| \Zend_Currency |

sub(float | integer | \Zend_Currency $value, string | \Zend_Currency $currency = null) : \Zend_CurrencySubstracts a currency
| Name | Type | Description |
|---|---|---|
| $value | float | integer | \Zend_Currency | Substracts this value from currency |
| $currency | string | \Zend_Currency | The currency to substract |
| Type | Description |
|---|---|
| \Zend_Currency |

toCurrency(integer | float $value = null, array $options = array()) : stringReturns a localized currency string
| Name | Type | Description |
|---|---|---|
| $value | integer | float | OPTIONAL Currency value |
| $options | array | OPTIONAL options to set temporary |
| Type | Description |
|---|---|
| string |
| Exception | Description |
|---|---|
| \Zend_Currency_Exception | When the value is not a number |