class CurrencyFormatter in Currency 7.2
Formats a currency according CLDR number pattern guidelines.
Hierarchy
- class \BartFeenstra\CLDR\IntegerFormatter
- class \BartFeenstra\CLDR\DecimalFormatter
- class \BartFeenstra\CLDR\CurrencyFormatter
- class \BartFeenstra\CLDR\DecimalFormatter
Expanded class hierarchy of CurrencyFormatter
2 files declare their use of CurrencyFormatter
- CurrencyFormatterTest.php in currency/
vendor/ bartfeenstra/ cldr/ src/ BartFeenstra/ Tests/ CLDR/ CurrencyFormatterTest.php - Contains class \BartFeenstra\Tests\CLDR\CurrencyFormatterTest.
- CurrencyLocalePattern.inc in currency/
includes/ CurrencyLocalePattern.inc - Contains class CurrencyLocalePattern.
File
- currency/
vendor/ bartfeenstra/ cldr/ src/ BartFeenstra/ CLDR/ CurrencyFormatter.php, line 13 - Contains class \BartFeenstra\CLDR\CurrencyFormatter.
Namespace
BartFeenstra\CLDRView source
class CurrencyFormatter extends DecimalFormatter {
/**
* The currency's symbol.
*
* @var string
*/
const SYMBOL_SPECIAL_CURRENCY = '¤';
/**
* Overrides parent::replacePlaceholders()
*/
function replacePlaceholders(array $symbols, array $replacements = array()) {
parent::replacePlaceholders($symbols, array(
self::SYMBOL_SPECIAL_CURRENCY,
));
}
/**
* Overrides parent::format().
*
* @param float|string $number
* @param string $currency_sign
* An ISO 4217 code or currency sign.
*/
public function format($number, $currency_sign = NULL) {
$this->symbol_replacements[self::SYMBOL_SPECIAL_CURRENCY] = $currency_sign;
return parent::format($number);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CurrencyFormatter:: |
public | function |
Overrides parent::format(). Overrides DecimalFormatter:: |
|
CurrencyFormatter:: |
function |
Overrides parent::replacePlaceholders() Overrides IntegerFormatter:: |
||
CurrencyFormatter:: |
constant | The currency's symbol. | ||
DecimalFormatter:: |
function |
Clones this formatter's NumberPatternSymbol objects. Overrides IntegerFormatter:: |
||
DecimalFormatter:: |
constant | Indicates a major pattern fragment. | ||
DecimalFormatter:: |
constant | Indicates a minor pattern fragment. | ||
DecimalFormatter:: |
constant | The decimal separator's symbol. | ||
DecimalFormatter:: |
function |
Overrides parent::__construct(). Overrides IntegerFormatter:: |
||
IntegerFormatter:: |
public | property | The original pattern. | |
IntegerFormatter:: |
protected | property | This pattern's symbols. | |
IntegerFormatter:: |
public | property | Replacements for occurrences of the self::SYMBOL_SPECIAL_* constants in $this->pattern. | |
IntegerFormatter:: |
function | Gets a replacement symbol for a placeholder. | ||
IntegerFormatter:: |
constant | Indicates a negative pattern. | ||
IntegerFormatter:: |
function | Converts a number pattern to an array of NumberPatternSymbol objects. | ||
IntegerFormatter:: |
protected | function | Splits a pattern into two fragments. | |
IntegerFormatter:: |
constant | PCRE meta characters. | ||
IntegerFormatter:: |
constant | Indicates a positive pattern. | ||
IntegerFormatter:: |
protected | function | Process the pattern's symbols using a number. | |
IntegerFormatter:: |
static | function | Reverses a string in a unicode-safe way. | |
IntegerFormatter:: |
static | function | Splits a string in a unicode-safe way. | |
IntegerFormatter:: |
function | Checks if a symbol is a special. | ||
IntegerFormatter:: |
constant | A digit. | ||
IntegerFormatter:: |
constant | An optional digit. | ||
IntegerFormatter:: |
constant | An escape character. | ||
IntegerFormatter:: |
constant | The pattern separator. | ||
IntegerFormatter:: |
constant | The grouping separator's symbol. | ||
IntegerFormatter:: |
constant | Infinity's symbol. | ||
IntegerFormatter:: |
constant | The minus sign's symbol. | ||
IntegerFormatter:: |
constant | "not a number"'s symbol. | ||
IntegerFormatter:: |
constant | The plus sign's symbol. | ||
IntegerFormatter:: |
function | Implements __clone(). |