API Documentation

Currency.php

Includes Classes 
category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Currency
version
$Id: Currency.php 22369 2010-06-04 14:54:43Z thomas $
Classes
Zend_Currency

Description

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.

Zend_Currency

category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Currency
Constants
NO_SYMBOL
USE_SYMBOL
USE_SHORTNAME
USE_NAME
STANDARD
RIGHT
LEFT
Properties
$_options
Methods
__construct
toCurrency
_extractPattern
setFormat
_checkParams
getSymbol
getShortName
getName
getRegionList
getCurrencyList
toString
__toString
getCache
setCache
hasCache
removeCache
clearCache
setLocale
getLocale
getValue
setValue
add
sub
div
mul
mod
compare
equals
isMore
isLess
_exchangeCurrency
getService
setService
_checkOptions

Description

Class for handling currency notations

Constants

NO_SYMBOL

 NO_SYMBOL = '1'

Details

value
1

USE_SYMBOL

 USE_SYMBOL = '2'

Details

value
2

USE_SHORTNAME

 USE_SHORTNAME = '3'

Details

value
3

USE_NAME

 USE_NAME = '4'

Details

value
4

STANDARD

 STANDARD = '8'

Details

value
8

RIGHT

 RIGHT = '16'

Details

value
16

LEFT

 LEFT = '32'

Details

value
32

Properties

$_options

array $_options = 'array'

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

Details

$_options
array
visibility
protected
default
array
final
false
static
false
see
Zend_Locale

Methods

__construct

__construct( string|array $options = null, string|Zend_Locale $locale = null ) :

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

Arguments
$options
stringarray
OPTIONAL Options array or currency short name when string is given
$locale
stringZend_Locale
OPTIONAL locale name
Details
visibility
public
final
false
static
false
throws
When currency is invalid

__toString

__toString( ) : string

Returns the currency name

Output
string
Details
visibility
public
final
false
static
false

_checkOptions

_checkOptions( array $options = array ) : array

Internal method for checking the options array

Arguments
$options
array
Options to check
Output
array
Details
visibility
protected
final
false
static
false
throws
On unknown position
throws
On unknown locale
throws
On unknown display
throws
On precision not between -1 and 30
throws
On problem with script conversion
throws
On unknown options

_checkParams

_checkParams( string $currency = null, string|Zend_Locale $locale = null ) : string

Internal function for checking static given locale parameter

Arguments
$currency
string
(Optional) Currency name
$locale
stringZend_Locale
(Optional) Locale to display informations
Output
string
The extracted locale representation as string
Details
visibility
private
final
false
static
false
throws
When locale contains no region

_exchangeCurrency

_exchangeCurrency( float|integer|Zend_Currency $value, string|Zend_Currency $currency ) : unknown

Internal method which calculates the exchanges currency

Arguments
$value
floatintegerZend_Currency
Compares the currency with this value
$currency
stringZend_Currency
The currency to compare this value from
Output
unknown
Details
visibility
protected
final
false
static
false

_extractPattern

_extractPattern( string $pattern, float|integer $value ) : string

Internal method to extract the currency pattern when a choice is given based on the given value

Arguments
$pattern
string
$value
floatinteger
Output
string
Details
visibility
private
final
false
static
false

add

add( float|integer|Zend_Currency $value, string|Zend_Currency $currency = null ) : Zend_Currency

Adds a currency

Arguments
$value
floatintegerZend_Currency
Add this value to currency
$currency
stringZend_Currency
The currency to add
Output
Zend_Currency
Details
visibility
public
final
false
static
false

clearCache

clearCache( ) : void

Clears all set cache data

Details
visibility
public
final
false
static
true

compare

compare( float|integer|Zend_Currency $value, string|Zend_Currency $currency = null ) : Zend_Currency

Compares two currencies

Arguments
$value
floatintegerZend_Currency
Compares the currency with this value
$currency
stringZend_Currency
The currency to compare this value from
Output
Zend_Currency
Details
visibility
public
final
false
static
false

div

div( float|integer|Zend_Currency $value, string|Zend_Currency $currency = null ) : Zend_Currency

Divides a currency

Arguments
$value
floatintegerZend_Currency
Divides this value from currency
$currency
stringZend_Currency
The currency to divide
Output
Zend_Currency
Details
visibility
public
final
false
static
false

equals

equals( float|integer|Zend_Currency $value, string|Zend_Currency $currency = null ) : boolean

Returns true when the two currencies are equal

Arguments
$value
floatintegerZend_Currency
Compares the currency with this value
$currency
stringZend_Currency
The currency to compare this value from
Output
boolean
Details
visibility
public
final
false
static
false

getCache

getCache( ) : Zend_Cache_Core

Returns the set cache

Output
Zend_Cache_Core
The set cache
Details
visibility
public
final
false
static
true

getCurrencyList

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

Arguments
$region
string
OPTIONAL Region to return the currencies for
Output
array
List of currencies
Details
visibility
public
final
false
static
false

getLocale

getLocale( ) : string

Returns the actual set locale

Output
string
Details
visibility
public
final
false
static
false

getName

getName( string $currency = null, string|Zend_Locale $locale = null ) : string

Returns the actual or details of other currency names

Arguments
$currency
string
(Optional) Currency's short name
$locale
stringZend_Locale
(Optional) The locale
Output
string
Details
visibility
public
final
false
static
false

getRegionList

getRegionList( string $currency = null ) : array

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

Arguments
$currency
string
OPTIONAL Currency's short name
Output
array
List of regions
Details
visibility
public
final
false
static
false
throws
When no currency was defined

getService

getService( ) : Zend_Service

Returns the set service class

Output
Zend_Service
Details
visibility
public
final
false
static
false

getShortName

getShortName( string $currency = null, string|Zend_Locale $locale = null ) : string

Returns the actual or details of other currency shortnames

Arguments
$currency
string
OPTIONAL Currency's name
$locale
stringZend_Locale
OPTIONAL The locale
Output
string
Details
visibility
public
final
false
static
false

getSymbol

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)

Arguments
$currency
string
(Optional) Currency name
$locale
stringZend_Locale
(Optional) Locale to display informations
Output
string
Details
visibility
public
final
false
static
false

getValue

getValue( ) : float

Returns the value

Output
float
Details
visibility
public
final
false
static
false

hasCache

hasCache( ) : boolean

Returns true when a cache is set

Output
boolean
Details
visibility
public
final
false
static
true

isLess

isLess( float|integer|Zend_Currency $value, string|Zend_Currency $currency = null ) : boolean

Returns true when the currency is less than the given value

Arguments
$value
floatintegerZend_Currency
Compares the currency with this value
$currency
stringZend_Currency
The currency to compare this value from
Output
boolean
Details
visibility
public
final
false
static
false

isMore

isMore( float|integer|Zend_Currency $value, string|Zend_Currency $currency = null ) : boolean

Returns true when the currency is more than the given value

Arguments
$value
floatintegerZend_Currency
Compares the currency with this value
$currency
stringZend_Currency
The currency to compare this value from
Output
boolean
Details
visibility
public
final
false
static
false

mod

mod( float|integer|Zend_Currency $value, string|Zend_Currency $currency = null ) : Zend_Currency

Calculates the modulo from a currency

Arguments
$value
floatintegerZend_Currency
Calculate modulo from this value
$currency
stringZend_Currency
The currency to calculate the modulo
Output
Zend_Currency
Details
visibility
public
final
false
static
false

mul

mul( float|integer|Zend_Currency $value, string|Zend_Currency $currency = null ) : Zend_Currency

Multiplies a currency

Arguments
$value
floatintegerZend_Currency
Multiplies this value from currency
$currency
stringZend_Currency
The currency to multiply
Output
Zend_Currency
Details
visibility
public
final
false
static
false

removeCache

removeCache( ) : void

Removes any set cache

Details
visibility
public
final
false
static
true

setCache

setCache( Zend_Cache_Core $cache ) : void

Sets a cache for Zend_Currency

Arguments
$cache
Zend_Cache_Core
Cache to set
Details
visibility
public
final
false
static
true

setFormat

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

Arguments
$options
array
(Optional) Options to set
Output
Zend_Currency
Details
visibility
public
final
false
static
false

setLocale

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

Arguments
$locale
stringZend_Locale
(Optional) Locale for parsing input
Output
Zend_Currency
Provides fluent interface
Details
visibility
public
final
false
static
false
throws
When the given locale does not exist

setService

setService( string|Zend_Currency_CurrencyInterface $service ) : Zend_Currency

Sets a new exchange service

Arguments
$service
stringZend_Currency_CurrencyInterface
Service class
Output
Zend_Currency
Details
visibility
public
final
false
static
false

setValue

setValue( float|integer|Zend_Currency $value, string|Zend_Currency $currency = null ) : Zend_Currency

Adds a currency

Arguments
$value
floatintegerZend_Currency
Add this value to currency
$currency
stringZend_Currency
The currency to add
Output
Zend_Currency
Details
visibility
public
final
false
static
false

sub

sub( float|integer|Zend_Currency $value, string|Zend_Currency $currency = null ) : Zend_Currency

Substracts a currency

Arguments
$value
floatintegerZend_Currency
Substracts this value from currency
$currency
stringZend_Currency
The currency to substract
Output
Zend_Currency
Details
visibility
public
final
false
static
false

toCurrency

toCurrency( integer|float $value = null, array $options = array ) : string

Returns a localized currency string

Arguments
$value
integerfloat
OPTIONAL Currency value
$options
array
OPTIONAL options to set temporary
Output
string
Details
visibility
public
final
false
static
false
throws
When the value is not a number

toString

toString( ) : string

Returns the actual currency name

Output
string
Details
visibility
public
final
false
static
false
Documentation was generated by DocBlox.