Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Static Public Member Functions
CurrencyInterface Interface Reference
Inheritance diagram for CurrencyInterface:
Currency

Public Member Functions

 toCurrency ($value=null, array $options=[])
 
 setFormat (array $options=[])
 
 getSymbol ($currency=null, $locale=null)
 
 getShortName ($currency=null, $locale=null)
 
 getName ($currency=null, $locale=null)
 
 getRegionList ($currency=null)
 
 getCurrencyList ($region=null)
 
 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)
 

Static Public Member Functions

static getCache ()
 
static setCache (\Zend_Cache_Core $cache)
 
static hasCache ()
 
static removeCache ()
 
static clearCache ($tag=null)
 

Detailed Description

@api

Since
100.0.2

Definition at line 12 of file CurrencyInterface.php.

Member Function Documentation

◆ add()

add (   $value,
  $currency = null 
)

Adds a currency

Parameters
float | integer | \Magento\Framework\CurrencyInterface$valueAdd this value to currency
string | \Magento\Framework\CurrencyInterface$currencyThe currency to add
Returns
\Magento\Framework\CurrencyInterface

◆ clearCache()

static clearCache (   $tag = null)
static

Clears all set cache data

Parameters
string$tagTag to clear when the default tag name is not used
Returns
void

◆ compare()

compare (   $value,
  $currency = null 
)

Compares two currencies

Parameters
float | integer | \Magento\Framework\CurrencyInterface$valueCompares the currency with this value
string | \Magento\Framework\CurrencyInterface$currencyThe currency to compare this value from
Returns
\Magento\Framework\CurrencyInterface

◆ div()

div (   $value,
  $currency = null 
)

Divides a currency

Parameters
float | integer | \Magento\Framework\CurrencyInterface$valueDivides this value from currency
string | \Magento\Framework\CurrencyInterface$currencyThe currency to divide
Returns
\Magento\Framework\CurrencyInterface

◆ equals()

equals (   $value,
  $currency = null 
)

Returns true when the two currencies are equal

Parameters
float | integer | \Magento\Framework\CurrencyInterface$valueCompares the currency with this value
string | \Magento\Framework\CurrencyInterface$currencyThe currency to compare this value from
Returns
boolean

◆ getCache()

static getCache ( )
static

Returns the set cache

Returns
\Zend_Cache_Core The set cache

◆ 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$regionOPTIONAL Region to return the currencies for
Returns
array List of currencies

◆ getLocale()

getLocale ( )

Returns the actual set locale

Returns
string

◆ getName()

getName (   $currency = null,
  $locale = null 
)

Returns the actual or details of other currency names

Parameters
string$currency(Optional) Currency's short name
string$locale(Optional) The locale
Returns
string

◆ getRegionList()

getRegionList (   $currency = null)

Returns a list of regions where this currency is or was known

Parameters
string$currencyOPTIONAL Currency's short name
Exceptions

◆ getShortName()

getShortName (   $currency = null,
  $locale = null 
)

Returns the actual or details of other currency shortnames

Parameters
string$currencyOPTIONAL Currency's name
string$localeOPTIONAL The locale
Returns
string

◆ 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$locale(Optional) Locale to display informations
Returns
string

◆ getValue()

getValue ( )

Returns the value

Returns
float

◆ hasCache()

static hasCache ( )
static

Returns true when a cache is set

Returns
boolean

◆ isLess()

isLess (   $value,
  $currency = null 
)

Returns true when the currency is less than the given value

Parameters
float | integer | \Magento\Framework\CurrencyInterface$valueCompares the currency with this value
string | \Magento\Framework\CurrencyInterface$currencyThe currency to compare this value from
Returns
boolean

◆ isMore()

isMore (   $value,
  $currency = null 
)

Returns true when the currency is more than the given value

Parameters
float | integer | \Magento\Framework\CurrencyInterface$valueCompares the currency with this value
string | \Magento\Framework\CurrencyInterface$currencyThe currency to compare this value from
Returns
boolean

◆ mod()

mod (   $value,
  $currency = null 
)

Calculates the modulo from a currency

Parameters
float | integer | \Magento\Framework\CurrencyInterface$valueCalculate modulo from this value
string | \Magento\Framework\CurrencyInterface$currencyThe currency to calculate the modulo
Returns
\Magento\Framework\CurrencyInterface

◆ mul()

mul (   $value,
  $currency = null 
)

Multiplies a currency

Parameters
float | integer | \Magento\Framework\CurrencyInterface$valueMultiplies this value from currency
string | \Magento\Framework\CurrencyInterface$currencyThe currency to multiply
Returns
\Magento\Framework\CurrencyInterface

◆ removeCache()

static removeCache ( )
static

Removes any set cache

Returns
void

◆ setCache()

static setCache ( \Zend_Cache_Core  $cache)
static

Sets a cache for \Magento\Framework\Currency

Parameters
\Zend_Cache_Core$cacheCache to set
Returns
void

◆ setFormat()

setFormat ( array  $options = [])

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
\Magento\Framework\CurrencyInterface

◆ setLocale()

setLocale (   $locale = null)

Sets a new locale for data retrievement 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$locale(Optional) Locale for parsing input
Exceptions

◆ setValue()

setValue (   $value,
  $currency = null 
)

Adds a currency

Parameters
float | integer | \Magento\Framework\CurrencyInterface$valueAdd this value to currency
string | \Magento\Framework\CurrencyInterface$currencyThe currency to add
Returns
\Magento\Framework\CurrencyInterface

◆ sub()

sub (   $value,
  $currency = null 
)

Substracts a currency

Parameters
float | integer | \Magento\Framework\CurrencyInterface$valueSubstracts this value from currency
string | \Magento\Framework\CurrencyInterface$currencyThe currency to substract
Returns
\Magento\Framework\CurrencyInterface

◆ toCurrency()

toCurrency (   $value = null,
array  $options = [] 
)

Returns a localized currency string

Parameters
integer | float$valueOPTIONAL Currency value
array$optionsOPTIONAL options to set temporary
Exceptions

◆ toString()

toString ( )

Returns the actual currency name

Returns
string

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