Class Zend_Currency

Description

Class for handling currency notations

  • copyright: Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  • license: New BSD License

Located in /Currency.php (line 37)


	
			
Class Constant Summary
 LEFT = 32
 NO_SYMBOL = 1
 RIGHT = 16
 STANDARD = 8
 USE_NAME = 4
Variable Summary
 array $_options
Method Summary
 static void clearCache ()
 static boolean hasCache ()
 static void removeCache ()
 static void setCache ( $cache)
 Zend_Currency __construct ([string|array $options = null], [string|Zend_Locale $locale = null])
 Zend_Currency add (float|integer|Zend_Currency $value, [string|Zend_Currency $currency = null])
 Zend_Currency compare (float|integer|Zend_Currency $value, [string|Zend_Currency $currency = null])
 Zend_Currency div (float|integer|Zend_Currency $value, [string|Zend_Currency $currency = null])
 boolean equals (float|integer|Zend_Currency $value, [string|Zend_Currency $currency = null])
 array getCurrencyList ([string $region = null])
 string getLocale ()
 string getName ([string $currency = null], [string|Zend_Locale $locale = null])
 array getRegionList ([string $currency = null])
 Zend_Service getService ()
 string getShortName ([string $currency = null], [string|Zend_Locale $locale = null])
 string getSymbol ([string $currency = null], [string|Zend_Locale $locale = null])
 float getValue ()
 boolean isLess (float|integer|Zend_Currency $value, [string|Zend_Currency $currency = null])
 boolean isMore (float|integer|Zend_Currency $value, [string|Zend_Currency $currency = null])
 Zend_Currency mod (float|integer|Zend_Currency $value, [string|Zend_Currency $currency = null])
 Zend_Currency mul (float|integer|Zend_Currency $value, [string|Zend_Currency $currency = null])
 Zend_Currency setFormat ([ $options = array()])
 Zend_Currency setLocale ([string|Zend_Locale $locale = null])
 Zend_Currency setValue (float|integer|Zend_Currency $value, [string|Zend_Currency $currency = null])
 Zend_Currency sub (float|integer|Zend_Currency $value, [string|Zend_Currency $currency = null])
 string toCurrency ([integer|float $value = null], [ $options = array()])
 string toString ()
 array _checkOptions ([ $options = array()])
 unknown _exchangeCurrency (float|integer|Zend_Currency $value, string|Zend_Currency $currency)
 string __toString ()
Variables
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
)
(line 69)

Options array

The following options are available 'position' => Position for the currency sign 'script' => Script for the output 'format' => Locale for numeric output 'display' => Currency detail to show 'precision' => Precision for the currency 'name' => Name for this currency 'currency' => 3 lettered international abbreviation 'symbol' => Currency symbol 'locale' => Locale for this currency 'value' => Money value 'service' => Exchange service to use

Methods
static clearCache (line 526)

Clears all set cache data

  • access: public
static void clearCache ()
static getCache (line 484)

Returns the set cache

  • return: The set cache
  • access: public
static Zend_Cache_Core getCache ()
static hasCache (line 506)

Returns true when a cache is set

  • access: public
static boolean hasCache ()
static removeCache (line 516)

Removes any set cache

  • access: public
static void removeCache ()
static setCache (line 496)

Sets a cache for Zend_Currency

  • access: public
static void setCache ( $cache)
Constructor __construct (line 91)

Creates a currency instance. Every supressed parameter is used from the actual or the given locale.

  • throws: Zend_Currency_Exception When currency is invalid
  • access: public
Zend_Currency __construct ([string|array $options = null], [string|Zend_Locale $locale = null])
  • string|array $options: OPTIONAL Options array or currency short name when string is given
  • string|Zend_Locale $locale: OPTIONAL locale name
add (line 604)

Adds a currency

  • access: public
Zend_Currency add (float|integer|Zend_Currency $value, [string|Zend_Currency $currency = null])
compare (line 674)

Compares two currencies

  • access: public
Zend_Currency compare (float|integer|Zend_Currency $value, [string|Zend_Currency $currency = null])
  • float|integer|Zend_Currency $value: Compares the currency with this value
  • string|Zend_Currency $currency: The currency to compare this value from
div (line 632)

Divides a currency

  • access: public
Zend_Currency div (float|integer|Zend_Currency $value, [string|Zend_Currency $currency = null])
equals (line 694)

Returns true when the two currencies are equal

  • access: public
boolean equals (float|integer|Zend_Currency $value, [string|Zend_Currency $currency = null])
  • float|integer|Zend_Currency $value: Compares the currency with this value
  • string|Zend_Currency $currency: The currency to compare this value from
getCurrencyList (line 448)

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

  • return: List of currencies
  • access: public
array getCurrencyList ([string $region = null])
  • string $region: OPTIONAL Region to return the currencies for
getLocale (line 569)

Returns the actual set locale

  • access: public
string getLocale ()
getName (line 395)

Returns the actual or details of other currency names

  • access: public
string getName ([string $currency = null], [string|Zend_Locale $locale = null])
  • string $currency: (Optional) Currency's short name
  • string|Zend_Locale $locale: (Optional) The locale
getRegionList (line 423)

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

  • return: List of regions
  • throws: Zend_Currency_Exception When no currency was defined
  • access: public
array getRegionList ([string $currency = null])
  • string $currency: OPTIONAL Currency's short name
getService (line 775)

Returns the set service class

  • access: public
Zend_Service getService ()
getShortName (line 360)

Returns the actual or details of other currency shortnames

  • access: public
string getShortName ([string $currency = null], [string|Zend_Locale $locale = null])
  • string $currency: OPTIONAL Currency's name
  • string|Zend_Locale $locale: OPTIONAL The locale
getSymbol (line 332)

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)

  • access: public
string getSymbol ([string $currency = null], [string|Zend_Locale $locale = null])
  • string $currency: (Optional) Currency name
  • string|Zend_Locale $locale: (Optional) Locale to display informations
getValue (line 579)

Returns the value

  • access: public
float getValue ()
isLess (line 728)

Returns true when the currency is less than the given value

  • access: public
boolean isLess (float|integer|Zend_Currency $value, [string|Zend_Currency $currency = null])
  • float|integer|Zend_Currency $value: Compares the currency with this value
  • string|Zend_Currency $currency: The currency to compare this value from
isMore (line 711)

Returns true when the currency is more than the given value

  • access: public
boolean isMore (float|integer|Zend_Currency $value, [string|Zend_Currency $currency = null])
  • float|integer|Zend_Currency $value: Compares the currency with this value
  • string|Zend_Currency $currency: The currency to compare this value from
mod (line 660)

Calculates the modulo from a currency

  • access: public
Zend_Currency mod (float|integer|Zend_Currency $value, [string|Zend_Currency $currency = null])
  • float|integer|Zend_Currency $value: Calculate modulo from this value
  • string|Zend_Currency $currency: The currency to calculate the modulo
mul (line 646)

Multiplies a currency

  • access: public
Zend_Currency mul (float|integer|Zend_Currency $value, [string|Zend_Currency $currency = null])
  • float|integer|Zend_Currency $value: Multiplies this value from currency
  • string|Zend_Currency $currency: The currency to multiply
setFormat (line 281)

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

  • access: public
Zend_Currency setFormat ([ $options = array()])
  • array $options: (Optional) Options to set
setLocale (line 540)

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

  • return: Provides fluent interface
  • throws: Zend_Currency_Exception When the given locale does not exist
  • access: public
Zend_Currency setLocale ([string|Zend_Locale $locale = null])
  • string|Zend_Locale $locale: (Optional) Locale for parsing input
setService (line 786)

Sets a new exchange service

  • access: public
Zend_Currency setService (string|Zend_Currency_CurrencyInterface $service)
setValue (line 591)

Adds a currency

  • access: public
Zend_Currency setValue (float|integer|Zend_Currency $value, [string|Zend_Currency $currency = null])
sub (line 618)

Substracts a currency

  • access: public
Zend_Currency sub (float|integer|Zend_Currency $value, [string|Zend_Currency $currency = null])
  • float|integer|Zend_Currency $value: Substracts this value from currency
  • string|Zend_Currency $currency: The currency to substract
toCurrency (line 137)

Returns a localized currency string

  • throws: Zend_Currency_Exception When the value is not a number
  • access: public
string toCurrency ([integer|float $value = null], [ $options = array()])
  • integer|float $value: OPTIONAL Currency value
  • array $options: OPTIONAL options to set temporary
toString (line 464)

Returns the actual currency name

  • access: public
string toString ()
_checkOptions (line 821)

Internal method for checking the options array

  • throws: Zend_Currency_Exception On unknown locale
  • throws: Zend_Currency_Exception On unknown position
  • throws: Zend_Currency_Exception On unknown options
  • throws: Zend_Currency_Exception On unknown display
  • throws: Zend_Currency_Exception On precision not between -1 and 30
  • throws: Zend_Currency_Exception On problem with script conversion
  • access: protected
array _checkOptions ([ $options = array()])
  • array $options: Options to check
_exchangeCurrency (line 746)

Internal method which calculates the exchanges currency

  • access: protected
unknown _exchangeCurrency (float|integer|Zend_Currency $value, string|Zend_Currency $currency)
  • float|integer|Zend_Currency $value: Compares the currency with this value
  • string|Zend_Currency $currency: The currency to compare this value from
__toString (line 474)

Returns the currency name

  • access: public
string __toString ()
Class Constants
LEFT = 32 (line 48)
NO_SYMBOL = 1 (line 40)
RIGHT = 16 (line 47)
STANDARD = 8 (line 46)
USE_NAME = 4 (line 43)
USE_SHORTNAME = 3 (line 42)
USE_SYMBOL = 2 (line 41)

Documentation generated on Mon, 21 Jun 2010 15:14:58 -0400 by phpDocumentor 1.4.3