CurrencyFormatter Class Reference

Inheritance diagram for CurrencyFormatter:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 CurrencyFormatter ()
 format ($amount, $ISOCode)
 formatWithSymbol ($amount, $ISOCode)
 validate ($amount, $ISOCode)
 toDecimal ($amount, $ISOCode)
 toDecimalForStyle ($amount, $style)
 supportsISOCode ($ISOCode)
 getFormattingStyles ()
 getISOCodes ()
 getStyleForISOCode ($ISOCode)
 getSymbol ($ISOCode)
 symbolIsAfterAmount ($ISOCode)
 getPrefixSuffixArray ($ISOCode)
 removePrefixAndSuffix ($amount, $ISOCode)
 getSeparators ($style)
 validateForStyle ($amount, $style)
 formatWithStyle ($amount, $style)

Public Attributes

 $formattingStyles
 $ISOCodeStyles
 $nonDollarSymbols
 $currenciesWithSymbolsAfterAmount

Detailed Description

Definition at line 40 of file mcurrencyformatter.class.


Member Function Documentation

CurrencyFormatter::CurrencyFormatter (  ) 

Sets up the instance variables. Must be called for the object to operate correctly. public

Definition at line 153 of file mcurrencyformatter.class.

CurrencyFormatter::format ( amount,
ISOCode 
)

Returns the specified amount formatted according to the formatting style used for the specified ISO 4217 currency code.

public

Parameters:
double $amount The amount to be formatted.
string $ISOCode ISO 4217 currency code.
Returns:
string The formatted amount.

Reimplemented in MCurrencyFormatter.

Definition at line 167 of file mcurrencyformatter.class.

References formatWithStyle(), and getStyleForISOCode().

Referenced by formatWithSymbol().

Here is the call graph for this function:

Here is the caller graph for this function:

CurrencyFormatter::formatWithSymbol ( amount,
ISOCode 
)

Returns the specified amount formatted according to the formatting style used for the specified ISO 4217 currency code with the currency symbol included.

Reimplemented in MCurrencyFormatter.

Definition at line 179 of file mcurrencyformatter.class.

References format(), and getPrefixSuffixArray().

Here is the call graph for this function:

CurrencyFormatter::validate ( amount,
ISOCode 
)

Validates whether the specified amount is properly formatted according to the formatting style used for the specified ISO 4217 currency code. Returns true if the specified amount is properly formatted.

public

Parameters:
double $amount The amount to be validated.
string $ISOCode ISO 4217 currency code.
Returns:
boolean True if $amount is properly formatted, false if not.

Reimplemented in MCurrencyFormatter.

Definition at line 198 of file mcurrencyformatter.class.

References getStyleForISOCode(), removePrefixAndSuffix(), and validateForStyle().

Here is the call graph for this function:

CurrencyFormatter::toDecimal ( amount,
ISOCode 
)

Returns the decimal amount represented by the amount according to the formatting style used for the specified ISO 4217 currency code.

public

Parameters:
double $amount The amount to be validated.
string $ISOCode ISO 4217 currency code.
Returns:
double

Reimplemented in MCurrencyFormatter.

Definition at line 216 of file mcurrencyformatter.class.

References getStyleForISOCode(), removePrefixAndSuffix(), and toDecimalForStyle().

Here is the call graph for this function:

CurrencyFormatter::toDecimalForStyle ( amount,
style 
)

Returns the decimal amount represented by the amount according to the specified formatting style.

public

Parameters:
double $amount The amount to be validated.
string $style The formatting style to be used.
Returns:
double

Definition at line 233 of file mcurrencyformatter.class.

References getSeparators().

Referenced by toDecimal().

Here is the call graph for this function:

Here is the caller graph for this function:

CurrencyFormatter::supportsISOCode ( ISOCode  ) 

Checks to see if the formatting for the specified code is supported.

Parameters:
string $ISOCode ISO 4217 currency code. public
Returns:
boolean

Definition at line 250 of file mcurrencyformatter.class.

CurrencyFormatter::getFormattingStyles (  ) 

Returns an hashtable of the supported formatting styles. public

Returns:
array

Definition at line 264 of file mcurrencyformatter.class.

CurrencyFormatter::getISOCodes (  ) 

Returns an array of the supported ISO 4217 codes. public

Returns:
array

Definition at line 275 of file mcurrencyformatter.class.

CurrencyFormatter::getStyleForISOCode ( ISOCode  ) 

Returns the key of the formatting style used for the specified ISO 4217 currency code.

public

Parameters:
string $ISOCode ISO 4217 currency code.
Returns:
string

Definition at line 296 of file mcurrencyformatter.class.

Referenced by format(), toDecimal(), and validate().

Here is the caller graph for this function:

CurrencyFormatter::getSymbol ( ISOCode  ) 

Returns the symbol (ie. '$' or 'Y') for the specified ISO 4217 currency code.

public

Parameters:
string $ISOCode ISO 4217 currency code.
Returns:
string

Definition at line 310 of file mcurrencyformatter.class.

Referenced by getPrefixSuffixArray().

Here is the caller graph for this function:

CurrencyFormatter::symbolIsAfterAmount ( ISOCode  ) 

Returns true if the symbol for the specified ISO 4217 currency code should be displayed after (to the right of) the amount.

public

Parameters:
string $ISOCode ISO 4217 currency code.
Returns:
boolean

Definition at line 330 of file mcurrencyformatter.class.

Referenced by getPrefixSuffixArray().

Here is the caller graph for this function:

CurrencyFormatter::getPrefixSuffixArray ( ISOCode  ) 

Convenience function that returns an array with two elements: a prefix and a suffix. eg. list($prefix, $suffix) = $cf->getPrefixSuffixArray( "AUD" ); echo $prefix.$cf->format( 9999.95, "AUD" ).$suffix; // outputs "$9,999.95"*

public

Parameters:
string $ISOCode ISO 4217 currency code.
Returns:
array

Definition at line 356 of file mcurrencyformatter.class.

References getSymbol(), and symbolIsAfterAmount().

Referenced by formatWithSymbol(), and removePrefixAndSuffix().

Here is the call graph for this function:

Here is the caller graph for this function:

CurrencyFormatter::removePrefixAndSuffix ( amount,
ISOCode 
)

Removes the prefix and suffix from an $amount formatted for the specified $ISOCode. public

Parameters:
double $amount
string $ISOCode
Returns:
string

Definition at line 380 of file mcurrencyformatter.class.

References getPrefixSuffixArray().

Referenced by toDecimal(), and validate().

Here is the call graph for this function:

Here is the caller graph for this function:

CurrencyFormatter::getSeparators ( style  ) 

Returns a two element array that contains the thousands separator and the the decimal place separator respectively for the specified formatting style.

private

Parameters:
string $style The formatting style to be used.
Returns:
array

Definition at line 397 of file mcurrencyformatter.class.

Referenced by toDecimalForStyle(), and validateForStyle().

Here is the caller graph for this function:

CurrencyFormatter::validateForStyle ( amount,
style 
)

Validates whether the specified amount is properly formatted according to the specified formatting style. Returns true if the specified amount is properly formatted.

public

Parameters:
double $amount The amount to be validated.
string $style The formatting style to validate.
Returns:
boolean

Definition at line 445 of file mcurrencyformatter.class.

References getSeparators().

Referenced by validate().

Here is the call graph for this function:

Here is the caller graph for this function:

CurrencyFormatter::formatWithStyle ( amount,
style 
)

Returns the specified amount formatted according to the specified formatting style.

public

Parameters:
double $amount The amount to be formatted.
string $style The style to be used for formatting.
Returns:
string

Definition at line 465 of file mcurrencyformatter.class.

Referenced by format().

Here is the caller graph for this function:


Member Data Documentation

CurrencyFormatter::$formattingStyles

Initial value:

 array(
                        "standard", 
                        "noDecimals",
                        "dotThousandsCommaDecimal", 
                        "apostropheThousandsDotDecimal",
                        "apostropheThousandsNoDecimals",
                        "spaceThousandsDotDecimal", 
                        "spaceThousandsCommaDecimal", 
                        "indian" 
        )
A list of all the supported currency formatting styles.

Definition at line 46 of file mcurrencyformatter.class.

CurrencyFormatter::$ISOCodeStyles

A hashtable that maps the supported ISO 4217 currency codes to the formatting style to be used for amounts in that currency.

Definition at line 61 of file mcurrencyformatter.class.

CurrencyFormatter::$nonDollarSymbols

A list of all the supported ISO 4217 currency codes that don't have a dollar sign as their symbol.

Definition at line 106 of file mcurrencyformatter.class.

CurrencyFormatter::$currenciesWithSymbolsAfterAmount

Initial value:

 array(
                        "DKR", "FIM", "FRF", "DEM", "GRD", "ISK", "ITL", "LTL",
                        "NOK", "ESP", "SEK", "THB", "CZK", "LUF", "PLZ", "PTE",
                        "TRL" 
        )
A list of the ISO 4217 currency codes that have their symbol displayed after the amount.

Definition at line 143 of file mcurrencyformatter.class.


The documentation for this class was generated from the following file:
CopyLeft (L) 2001-2006 - [MIOLO Development Team] SOLIS - Cooperativa de Soluções Livres - Lajeado/RS - Brasil