|
| __construct ($options=null, $locale=null) |
|
| toCurrency ($value=null, array $options=array()) |
|
| setFormat (array $options=array()) |
|
| getSymbol ($currency=null, $locale=null) |
|
| getShortName ($currency=null, $locale=null) |
|
| getName ($currency=null, $locale=null) |
|
| getRegionList ($currency=null) |
|
| getCurrencyList ($region=null) |
|
| toString () |
|
| __toString () |
|
| setLocale ($locale=null) |
|
| getLocale () |
|
| getValue () |
|
| setValue ($value, $currency=null) |
|
| add ($value, $currency=null) |
|
| sub ($value, $currency=null) |
|
| div ($value, $currency=null) |
|
| mul ($value, $currency=null) |
|
| mod ($value, $currency=null) |
|
| compare ($value, $currency=null) |
|
| equals ($value, $currency=null) |
|
| isMore ($value, $currency=null) |
|
| isLess ($value, $currency=null) |
|
| getService () |
|
| setService ($service) |
|
Definition at line 37 of file Currency.php.
◆ __construct()
__construct |
( |
|
$options = null , |
|
|
|
$locale = null |
|
) |
| |
Creates a currency instance. Every supressed parameter is used from the actual or the given locale.
- Parameters
-
string | array | $options | OPTIONAL Options array or currency short name when string is given |
string | Zend_Locale | $locale | OPTIONAL locale name |
- Exceptions
-
Definition at line 92 of file Currency.php.
96 $this->_options[
'display'] =
$options[
'display'];
110 if (!isset($this->_options[
'currency']) || !is_array(
$options)) {
114 if (!isset($this->_options[
'name']) || !is_array(
$options)) {
118 if (!isset($this->_options[
'symbol']) || !is_array(
$options)) {
122 if (($this->_options[
'currency'] ===
null) and ($this->_options[
'name'] ===
null)) {
123 #require_once 'Zend/Currency/Exception.php'; 128 if ((is_array($calloptions) && !isset($calloptions[
'display']))
129 || (!is_array($calloptions) && $this->_options[
'display'] == self::NO_SYMBOL)) {
130 if (!empty($this->_options[
'symbol'])) {
132 }
else if (!empty($this->_options[
'currency'])) {
getName($currency=null, $locale=null)
getSymbol($currency=null, $locale=null)
setFormat(array $options=array())
getShortName($currency=null, $locale=null)
static isLocale($locale, $strict=false, $compatible=true)
◆ __toString()
Returns the currency name
- Returns
- string
Definition at line 486 of file Currency.php.
◆ _checkOptions()
_checkOptions |
( |
array |
$options = array() | ) |
|
|
protected |
Internal method for checking the options array
- Parameters
-
array | $options | Options to check |
- Exceptions
-
- Returns
- array
Definition at line 833 of file Currency.php.
841 if (
$name !==
'format') {
842 if (gettype(
$value) ===
'string') {
849 if ((
$value !== self::STANDARD) and (
$value !== self::RIGHT) and (
$value !== self::LEFT)) {
850 #require_once 'Zend/Currency/Exception.php'; 858 if (!is_string(
$value) || (strpos(
$value,
'0') ===
false)) {
859 #require_once 'Zend/Currency/Exception.php'; 862 .
"' is no format token");
868 if (is_numeric(
$value) and (
$value !== self::NO_SYMBOL) and (
$value !== self::USE_SYMBOL) and
869 (
$value !== self::USE_SHORTNAME) and (
$value !== self::USE_NAME)) {
870 #require_once 'Zend/Currency/Exception.php'; 881 #require_once 'Zend/Currency/Exception.php'; 890 #require_once 'Zend/Currency/Exception.php';
static isLocale($locale, $strict=false, $compatible=true)
if(!isset($_GET['name'])) $name
◆ _exchangeCurrency()
_exchangeCurrency |
( |
|
$value, |
|
|
|
$currency |
|
) |
| |
|
protected |
Internal method which calculates the exchanges currency
- Parameters
-
float | integer | Zend_Currency | $value | Compares the currency with this value |
string | Zend_Currency | $currency | The currency to compare this value from |
- Returns
- unknown
Definition at line 758 of file Currency.php.
761 $currency =
$value->getShortName();
771 #require_once 'Zend/Currency/Exception.php';
getShortName($currency=null, $locale=null)
◆ add()
add |
( |
|
$value, |
|
|
|
$currency = null |
|
) |
| |
Adds a currency
- Parameters
-
- Returns
- Zend_Currency
Definition at line 616 of file Currency.php.
619 $this->_options[
'value'] += (float)
$value;
_exchangeCurrency($value, $currency)
◆ clearCache()
static clearCache |
( |
|
$tag = null | ) |
|
|
static |
Clears all set cache data
- Parameters
-
string | $tag | Tag to clear when the default tag name is not used |
- Returns
- void
Definition at line 538 of file Currency.php.
◆ compare()
compare |
( |
|
$value, |
|
|
|
$currency = null |
|
) |
| |
Compares two currencies
- Parameters
-
float | integer | Zend_Currency | $value | Compares the currency with this value |
string | Zend_Currency | $currency | The currency to compare this value from |
- Returns
- Zend_Currency
Definition at line 686 of file Currency.php.
_exchangeCurrency($value, $currency)
◆ div()
div |
( |
|
$value, |
|
|
|
$currency = null |
|
) |
| |
Divides a currency
- Parameters
-
- Returns
- Zend_Currency
Definition at line 644 of file Currency.php.
647 $this->_options[
'value'] /= (float)
$value;
_exchangeCurrency($value, $currency)
◆ equals()
equals |
( |
|
$value, |
|
|
|
$currency = null |
|
) |
| |
Returns true when the two currencies are equal
- Parameters
-
float | integer | Zend_Currency | $value | Compares the currency with this value |
string | Zend_Currency | $currency | The currency to compare this value from |
- Returns
- boolean
Definition at line 706 of file Currency.php.
709 if ($this->_options[
'value'] ==
$value) {
_exchangeCurrency($value, $currency)
◆ getCache()
◆ getCurrencyList()
getCurrencyList |
( |
|
$region = null | ) |
|
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
-
string | $region | OPTIONAL Region to return the currencies for |
- Returns
- array List of currencies
Definition at line 457 of file Currency.php.
459 if (empty($region) ===
true) {
460 if (strlen($this->_options[
'locale']) > 4) {
461 $region = substr($this->_options[
'locale'], (strpos($this->_options[
'locale'],
'_') + 1));
static getContent($locale, $path, $value=false)
◆ getLocale()
Returns the actual set locale
- Returns
- string
Definition at line 581 of file Currency.php.
583 return $this->_options[
'locale'];
◆ getName()
getName |
( |
|
$currency = null , |
|
|
|
$locale = null |
|
) |
| |
Returns the actual or details of other currency names
- Parameters
-
string | $currency | (Optional) Currency's short name |
string | Zend_Locale | $locale | (Optional) The locale |
- Returns
- string
Definition at line 404 of file Currency.php.
406 if (($currency ===
null) and ($locale ===
null)) {
407 return $this->_options[
'name'];
410 $params = self::_checkParams($currency, $locale);
414 if (empty(
$name) ===
true) {
418 if (empty(
$name) ===
true) {
static getContent($locale, $path, $value=false)
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE]
if(!isset($_GET['name'])) $name
◆ getRegionList()
getRegionList |
( |
|
$currency = null | ) |
|
Returns a list of regions where this currency is or was known
- Parameters
-
string | $currency | OPTIONAL Currency's short name |
- Exceptions
-
- Returns
- array List of regions
Definition at line 432 of file Currency.php.
434 if ($currency ===
null) {
435 $currency = $this->_options[
'currency'];
438 if (empty($currency) ===
true) {
439 #require_once 'Zend/Currency/Exception.php';
static getContent($locale, $path, $value=false)
◆ getService()
Returns the set service class
- Returns
- Zend_Service
Definition at line 787 of file Currency.php.
789 return $this->_options[
'service'];
◆ getShortName()
getShortName |
( |
|
$currency = null , |
|
|
|
$locale = null |
|
) |
| |
Returns the actual or details of other currency shortnames
- Parameters
-
string | $currency | OPTIONAL Currency's name |
string | Zend_Locale | $locale | OPTIONAL The locale |
- Returns
- string
Definition at line 369 of file Currency.php.
371 if (($currency ===
null) and ($locale ===
null)) {
372 return $this->_options[
'currency'];
375 $params = self::_checkParams($currency, $locale);
378 if (empty(
$params[
'currency']) ===
true) {
383 if (empty($list) ===
true) {
385 if (empty($list) ===
false) {
390 if (empty($list) ===
true) {
static getContent($locale, $path, $value=false)
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE]
◆ getSymbol()
getSymbol |
( |
|
$currency = null , |
|
|
|
$locale = null |
|
) |
| |
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
-
string | $currency | (Optional) Currency name |
string | Zend_Locale | $locale | (Optional) Locale to display informations |
- Returns
- string
Definition at line 341 of file Currency.php.
343 if (($currency ===
null) and ($locale ===
null)) {
344 return $this->_options[
'symbol'];
347 $params = self::_checkParams($currency, $locale);
351 if (empty($symbol) ===
true) {
355 if (empty($symbol) ===
true) {
static getContent($locale, $path, $value=false)
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE]
◆ getValue()
Returns the value
- Returns
- float
Definition at line 591 of file Currency.php.
593 return $this->_options[
'value'];
◆ hasCache()
Returns true when a cache is set
- Returns
- boolean
Definition at line 517 of file Currency.php.
◆ isLess()
isLess |
( |
|
$value, |
|
|
|
$currency = null |
|
) |
| |
Returns true when the currency is less than the given value
- Parameters
-
float | integer | Zend_Currency | $value | Compares the currency with this value |
string | Zend_Currency | $currency | The currency to compare this value from |
- Returns
- boolean
Definition at line 740 of file Currency.php.
743 if ($this->_options[
'value'] <
$value) {
_exchangeCurrency($value, $currency)
◆ isMore()
isMore |
( |
|
$value, |
|
|
|
$currency = null |
|
) |
| |
Returns true when the currency is more than the given value
- Parameters
-
float | integer | Zend_Currency | $value | Compares the currency with this value |
string | Zend_Currency | $currency | The currency to compare this value from |
- Returns
- boolean
Definition at line 723 of file Currency.php.
726 if ($this->_options[
'value'] >
$value) {
_exchangeCurrency($value, $currency)
◆ mod()
mod |
( |
|
$value, |
|
|
|
$currency = null |
|
) |
| |
Calculates the modulo from a currency
- Parameters
-
float | integer | Zend_Currency | $value | Calculate modulo from this value |
string | Zend_Currency | $currency | The currency to calculate the modulo |
- Returns
- Zend_Currency
Definition at line 672 of file Currency.php.
675 $this->_options[
'value'] %= (float)
$value;
_exchangeCurrency($value, $currency)
◆ mul()
mul |
( |
|
$value, |
|
|
|
$currency = null |
|
) |
| |
Multiplies a currency
- Parameters
-
- Returns
- Zend_Currency
Definition at line 658 of file Currency.php.
661 $this->_options[
'value'] *= (float)
$value;
_exchangeCurrency($value, $currency)
◆ removeCache()
Removes any set cache
- Returns
- void
Definition at line 527 of file Currency.php.
◆ setCache()
◆ setFormat()
setFormat |
( |
array |
$options = array() | ) |
|
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
-
array | $options | (Optional) Options to set |
- Returns
- Zend_Currency
Definition at line 290 of file Currency.php.
_checkOptions(array $options=array())
◆ setLocale()
setLocale |
( |
|
$locale = null | ) |
|
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
-
string | Zend_Locale | $locale | (Optional) Locale for parsing input |
- Exceptions
-
- Returns
- Zend_Currency Provides fluent interface
Definition at line 552 of file Currency.php.
554 #require_once 'Zend/Locale.php'; 557 if (strlen($locale) > 4) {
558 $this->_options[
'locale'] = $locale;
560 #require_once 'Zend/Currency/Exception.php'; 564 #require_once 'Zend/Currency/Exception.php'; 569 $this->_options[
'currency'] = $this->
getShortName(
null, $this->_options[
'locale']);
570 $this->_options[
'name'] = $this->
getName(
null, $this->_options[
'locale']);
571 $this->_options[
'symbol'] = $this->
getSymbol(
null, $this->_options[
'locale']);
getName($currency=null, $locale=null)
getSymbol($currency=null, $locale=null)
getShortName($currency=null, $locale=null)
static findLocale($locale=null)
◆ setService()
Sets a new exchange service
- Parameters
-
- Returns
- Zend_Currency
Definition at line 798 of file Currency.php.
801 #require_once 'Zend/Loader.php'; 803 $file = str_replace(
'_', DIRECTORY_SEPARATOR,
$service) .
'.php';
813 #require_once 'Zend/Currency/Exception.php'; 817 $this->_options[
'service'] =
$service;
static loadClass($class, $dirs=null)
static isReadable($filename)
◆ setValue()
setValue |
( |
|
$value, |
|
|
|
$currency = null |
|
) |
| |
◆ sub()
sub |
( |
|
$value, |
|
|
|
$currency = null |
|
) |
| |
Substracts a currency
- Parameters
-
- Returns
- Zend_Currency
Definition at line 630 of file Currency.php.
633 $this->_options[
'value'] -= (float)
$value;
_exchangeCurrency($value, $currency)
◆ toCurrency()
toCurrency |
( |
|
$value = null , |
|
|
array |
$options = array() |
|
) |
| |
Returns a localized currency string
- Parameters
-
integer | float | $value | OPTIONAL Currency value |
array | $options | OPTIONAL options to set temporary |
- Exceptions
-
- Returns
- string
Definition at line 146 of file Currency.php.
152 $value = $this->_options[
'value'];
164 if (!(isset(
$value)) or (is_numeric(
$value) ===
false)) {
165 #require_once 'Zend/Currency/Exception.php'; 171 $options[
'locale'] = $this->_options[
'locale'];
194 'precision' =>
$options[
'precision']));
196 if (
$options[
'position'] !== self::STANDARD) {
199 if (iconv_strpos(
$value,
' ') !==
false) {
204 if (
$options[
'position'] == self::LEFT) {
212 if (empty(
$options[
'script']) ===
false) {
217 if (is_numeric(
$options[
'display']) ===
false) {
222 $sign = $this->_extractPattern(
$options[
'symbol'], $original);
getName($currency=null, $locale=null)
static getContent($locale, $path, $value=false)
getSymbol($currency=null, $locale=null)
getShortName($currency=null, $locale=null)
_checkOptions(array $options=array())
static isLocale($locale, $strict=false, $compatible=true)
◆ toString()
Returns the actual currency name
- Returns
- string
Definition at line 476 of file Currency.php.
toCurrency($value=null, array $options=array())
◆ $_options
Initial value:= 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'
)
Definition at line 69 of file Currency.php.
◆ LEFT
◆ NO_SYMBOL
◆ RIGHT
◆ STANDARD
◆ USE_NAME
◆ USE_SHORTNAME
◆ USE_SYMBOL
The documentation for this class was generated from the following file: