PHP 클래스 Neos\Flow\I18n\Formatter\NumberFormatter

상속: implements Neos\Flow\I18n\Formatter\FormatterInterface
파일 보기 프로젝트 열기: neos/flow-development-collection 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$numbersReader Neos\Flow\I18n\Cldr\Reader\NumbersReader

공개 메소드들

메소드 설명
format ( mixed $value, Locale $locale, array $styleProperties = [] ) : string Formats provided value using optional style properties
formatCurrencyNumber ( mixed $number, Locale $locale, string $currency, string $formatLength = NumbersReader::FORMAT_LENGTH_DEFAULT ) : string Formats number with format string for currency defined in CLDR for particular locale.
formatDecimalNumber ( mixed $number, Locale $locale, string $formatLength = NumbersReader::FORMAT_LENGTH_DEFAULT ) : string Formats number with format string for decimal numbers defined in CLDR for particular locale.
formatNumberWithCustomPattern ( mixed $number, string $format, Locale $locale ) : string Returns number formatted by custom format, string provided in parameter.
formatPercentNumber ( mixed $number, Locale $locale, string $formatLength = NumbersReader::FORMAT_LENGTH_DEFAULT ) : string Formats number with format string for percentage defined in CLDR for particular locale.
injectNumbersReader ( NumbersReader $numbersReader ) : void

보호된 메소드들

메소드 설명
doFormattingWithParsedFormat ( mixed $number, array $parsedFormat, array $symbols, string $currency = null ) : string Formats provided float or integer.

메소드 상세

doFormattingWithParsedFormat() 보호된 메소드

Format rules defined in $parsedFormat array are used. Localizable symbols are replaced with elements from $symbols array, and currency placeholder is replaced with the value of $currency, if not NULL. If $number is NaN or infinite, proper localized symbol will be returned, as defined in CLDR specification.
protected doFormattingWithParsedFormat ( mixed $number, array $parsedFormat, array $symbols, string $currency = null ) : string
$number mixed Float or int, can be negative, can be NaN or infinite
$parsedFormat array An array describing format (as in $parsedFormats property)
$symbols array An array with symbols to use (as in $localeSymbols property)
$currency string Currency symbol to be inserted into formatted number (if applicable)
리턴 string Formatted number. Will return string-casted version of $number if pattern is FALSE

format() 공개 메소드

Formats provided value using optional style properties
public format ( mixed $value, Locale $locale, array $styleProperties = [] ) : string
$value mixed Formatter-specific variable to format (can be integer, \DateTime, etc)
$locale Neos\Flow\I18n\Locale Locale to use
$styleProperties array Integer-indexed array of formatter-specific style properties (can be empty)
리턴 string String representation of $value provided, or (string)$value

formatCurrencyNumber() 공개 메소드

Currency symbol provided will be inserted into formatted number string. Note: currently length is not used in currencyFormats from CLDR. But it's defined in the specification, so we support it here.
public formatCurrencyNumber ( mixed $number, Locale $locale, string $currency, string $formatLength = NumbersReader::FORMAT_LENGTH_DEFAULT ) : string
$number mixed Float or int, can be negative, can be NaN or infinite
$locale Neos\Flow\I18n\Locale
$currency string Currency symbol (or name)
$formatLength string One of NumbersReader FORMAT_LENGTH constants
리턴 string Formatted number. Will return string-casted version of $number if there is no pattern for given $locale / $formatLength

formatDecimalNumber() 공개 메소드

Note: currently length is not used in decimalFormats from CLDR. But it's defined in the specification, so we support it here.
public formatDecimalNumber ( mixed $number, Locale $locale, string $formatLength = NumbersReader::FORMAT_LENGTH_DEFAULT ) : string
$number mixed Float or int, can be negative, can be NaN or infinite
$locale Neos\Flow\I18n\Locale
$formatLength string One of NumbersReader FORMAT_LENGTH constants
리턴 string Formatted number. Will return string-casted version of $number if there is no pattern for given $locale / $formatLength

formatNumberWithCustomPattern() 공개 메소드

Format must obey syntax defined in CLDR specification, excluding unimplemented features (see documentation for this class). Format is remembered in this classes cache and won't be parsed again for some time.
public formatNumberWithCustomPattern ( mixed $number, string $format, Locale $locale ) : string
$number mixed Float or int, can be negative, can be NaN or infinite
$format string Format string
$locale Neos\Flow\I18n\Locale A locale used for finding symbols array
리턴 string Formatted number. Will return string-casted version of $number if pattern is not valid / supported

formatPercentNumber() 공개 메소드

Note: currently length is not used in percentFormats from CLDR. But it's defined in the specification, so we support it here.
public formatPercentNumber ( mixed $number, Locale $locale, string $formatLength = NumbersReader::FORMAT_LENGTH_DEFAULT ) : string
$number mixed Float or int, can be negative, can be NaN or infinite
$locale Neos\Flow\I18n\Locale
$formatLength string One of NumbersReader FORMAT_LENGTH constants
리턴 string Formatted number. Will return string-casted version of $number if there is no pattern for given $locale / $formatLength

injectNumbersReader() 공개 메소드

public injectNumbersReader ( NumbersReader $numbersReader ) : void
$numbersReader Neos\Flow\I18n\Cldr\Reader\NumbersReader
리턴 void

프로퍼티 상세

$numbersReader 보호되어 있는 프로퍼티

protected NumbersReader,Neos\Flow\I18n\Cldr\Reader $numbersReader
리턴 Neos\Flow\I18n\Cldr\Reader\NumbersReader