You are here

function IntegerFormatter::__construct in Currency 7.2

Implements __construct().

Parameters

string $pattern: A Unicode CLDR number pattern, without short number support. See http://cldr.unicode.org/translation/number-patterns.

array $symbol_replacements: Keys are one of the self::SYMBOL_SPECIAL_* constants, values are their replacements.

1 method overrides IntegerFormatter::__construct()
DecimalFormatter::__construct in currency/vendor/bartfeenstra/cldr/src/BartFeenstra/CLDR/DecimalFormatter.php
Overrides parent::__construct().

File

currency/vendor/bartfeenstra/cldr/src/BartFeenstra/CLDR/IntegerFormatter.php, line 135
Contains class \BartFeenstra\CLDR\IntegerFormatter.

Class

IntegerFormatter
Formats an integer according CLDR number pattern guidelines.

Namespace

BartFeenstra\CLDR

Code

function __construct($pattern, array $symbol_replacements = array()) {
  $this->pattern = $pattern;
  $this->symbol_replacements = $symbol_replacements;
  $this->symbols = $this
    ->patternSymbolsSplit($this
    ->patternSymbols($pattern), self::SYMBOL_PATTERN_SEPARATOR, TRUE);

  // If there is no negative pattern, add a default.
  if ($this->symbols[self::NEGATIVE] === FALSE) {
    $pattern .= ';-' . $pattern;
    $this->symbols = $this
      ->patternSymbolsSplit($this
      ->patternSymbols($pattern), self::SYMBOL_PATTERN_SEPARATOR, TRUE);
  }
  foreach ($this->symbols as $sign_symbols) {
    if (empty($sign_symbols)) {
      throw new \InvalidArgumentException('Empty number pattern.');
    }
  }
}