PHP 클래스 Neos\Flow\I18n\Cldr\Reader\NumbersReader

The most important functionality of this class is formatting numbers. This is an implementation of Number Format Patterns as defined in Unicode Technical Standard #35. However, it's not complete implementation as for now. Following features are missing (in brackets - chapter from specification): - support for escaping of special characters in format string [part of G.2] - formatting numbers to scientific notation [G.4] - support for significant digits [G.5] - support for padding [G.6] - formatting numbers in other number systems than "latn" - currency symbol substitution is simplified
또한 보기: http://www.unicode.org/reports/tr35/#Number_Elements
또한 보기: http://www.unicode.org/reports/tr35/#Number_Format_Patterns
파일 보기 프로젝트 열기: neos/flow-development-collection 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$cache Neos\Cache\Frontend\VariableFrontend
$cldrRepository Neos\Flow\I18n\Cldr\CldrRepository
$localizedSymbols array Locale identifiers are keys for this array. Values are arrays of symbols, as defined in /ldml/numbers/symbols path in CLDR files.
$parsedFormats array Example of data stored in this array (default values): '#,##0.###' => array( 'positivePrefix' => '', 'positiveSuffix' => '', 'negativePrefix' => '-', 'negativeSuffix' => '', 'multiplier' => 1, 'minDecimalDigits' => 0, 'maxDecimalDigits' => 0, 'minIntegerDigits' => 1, 'primaryGroupingSize' => 0, 'secondaryGroupingSize' => 0, 'rounding' => 0.0, ); Legend: - positivePrefix / positiveSuffix: a character to place before / after the number, if it's positive. - negativePrefix / Suffix: same as above, but for negative numbers. - multiplier: Used for percents or permiles (100 and 1000 accordingly). - minDecimalDigits: same as above, but for decimal part of the number. No less than 0 (which means no decimal part). - maxDecimalDigits: same as above, but for decimal part of the number. No less than 0 (which means no decimal part). - minIntegerDigits: at least so many digits will be printed for integer part of the number (padded with zeros if needed). No less than 1. - primaryGroupingSize: Where to put the first grouping separator (e.g. thousands). Zero means no separator (also no secondary separator!). - secondaryGroupingSize: Where to put the second grouping separators (used after the primary separator - eg for primaryGroupingSize set to 3 and secondaryGroupingSize set to 2, number 123456789 will be 12,34,56,789). For most languages, this is the same as primaryGroupingSize. - rounding: If set, number will be rounded to the multiple of this value. Can be float or integer. Zero means no rounding. Note: there can be characters in prefix / suffix elements which will be localized during formatting (eg minus sign, percent etc), or other chars which will be used as-is.
$parsedFormatsIndices array As for one locale there can be defined many formats (at most 3 format types supported by this class - decimal, percent, currency - multiplied by at most 5 format lengths - full, long, medium, short, and implicit length referred in this class as 'default'), references are organized in arrays. Example of data stored in this array: 'pl' => array( 'decimal' => array( 'default' => '#,##0.###', ... ), ... );

공개 메소드들

메소드 설명
getLocalizedSymbolsForLocale ( Locale $locale ) : array Returns symbols array for provided locale.
initializeObject ( ) : void Constructs the reader, loading parsed data from cache if available.
injectCache ( Neos\Cache\Frontend\VariableFrontend $cache ) : void Injects the Flow_I18n_CDLR_Reader_NumbersReader cache
injectCldrRepository ( CldrRepository $repository ) : void
parseCustomFormat ( string $format ) : array Returns parsed date or time format string provided as parameter.
parseFormatFromCldr ( Locale $locale, string $formatType, string $formatLength = self::FORMAT_LENGTH_DEFAULT ) : array Returns parsed number format basing on locale and desired format length if provided.
shutdownObject ( ) : void Shutdowns the object, saving parsed format strings to the cache.
validateFormatLength ( string $formatLength ) : void Validates provided format length and throws exception if value is not allowed.
validateFormatType ( string $formatType ) : void Validates provided format type and throws exception if value is not allowed.

보호된 메소드들

메소드 설명
parseFormat ( string $format ) : array Parses a number format (with syntax defined in CLDR).

메소드 상세

getLocalizedSymbolsForLocale() 공개 메소드

Symbols are elements defined in tag symbols from CLDR. They define localized versions of various number-related elements, like decimal separator, group separator or minus sign. Symbols arrays for every requested locale are cached.
public getLocalizedSymbolsForLocale ( Locale $locale ) : array
$locale Neos\Flow\I18n\Locale
리턴 array Symbols array

initializeObject() 공개 메소드

Constructs the reader, loading parsed data from cache if available.
public initializeObject ( ) : void
리턴 void

injectCache() 공개 메소드

Injects the Flow_I18n_CDLR_Reader_NumbersReader cache
public injectCache ( Neos\Cache\Frontend\VariableFrontend $cache ) : void
$cache Neos\Cache\Frontend\VariableFrontend
리턴 void

injectCldrRepository() 공개 메소드

public injectCldrRepository ( CldrRepository $repository ) : void
$repository Neos\Flow\I18n\Cldr\CldrRepository
리턴 void

parseCustomFormat() 공개 메소드

Returns parsed date or time format string provided as parameter.
public parseCustomFormat ( string $format ) : array
$format string Format string to parse
리턴 array An array representing parsed format

parseFormat() 보호된 메소드

Not all features from CLDR specification are implemented. Please see the documentation for this class for details what is missing.
또한 보기: NumbersReader::$parsedFormats
protected parseFormat ( string $format ) : array
$format string
리턴 array Parsed format

parseFormatFromCldr() 공개 메소드

When third parameter ($formatLength) equals 'default', default format for a locale will be used.
public parseFormatFromCldr ( Locale $locale, string $formatType, string $formatLength = self::FORMAT_LENGTH_DEFAULT ) : array
$locale Neos\Flow\I18n\Locale
$formatType string A type of format (one of constant values)
$formatLength string A length of format (one of constant values)
리턴 array An array representing parsed format

shutdownObject() 공개 메소드

Shutdowns the object, saving parsed format strings to the cache.
public shutdownObject ( ) : void
리턴 void

validateFormatLength() 공개 정적인 메소드

Validates provided format length and throws exception if value is not allowed.
public static validateFormatLength ( string $formatLength ) : void
$formatLength string
리턴 void

validateFormatType() 공개 정적인 메소드

Validates provided format type and throws exception if value is not allowed.
public static validateFormatType ( string $formatType ) : void
$formatType string
리턴 void

프로퍼티 상세

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

protected VariableFrontend,Neos\Cache\Frontend $cache
리턴 Neos\Cache\Frontend\VariableFrontend

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

protected CldrRepository,Neos\Flow\I18n\Cldr $cldrRepository
리턴 Neos\Flow\I18n\Cldr\CldrRepository

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

Locale identifiers are keys for this array. Values are arrays of symbols, as defined in /ldml/numbers/symbols path in CLDR files.
protected array $localizedSymbols
리턴 array

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

Example of data stored in this array (default values): '#,##0.###' => array( 'positivePrefix' => '', 'positiveSuffix' => '', 'negativePrefix' => '-', 'negativeSuffix' => '', 'multiplier' => 1, 'minDecimalDigits' => 0, 'maxDecimalDigits' => 0, 'minIntegerDigits' => 1, 'primaryGroupingSize' => 0, 'secondaryGroupingSize' => 0, 'rounding' => 0.0, ); Legend: - positivePrefix / positiveSuffix: a character to place before / after the number, if it's positive. - negativePrefix / Suffix: same as above, but for negative numbers. - multiplier: Used for percents or permiles (100 and 1000 accordingly). - minDecimalDigits: same as above, but for decimal part of the number. No less than 0 (which means no decimal part). - maxDecimalDigits: same as above, but for decimal part of the number. No less than 0 (which means no decimal part). - minIntegerDigits: at least so many digits will be printed for integer part of the number (padded with zeros if needed). No less than 1. - primaryGroupingSize: Where to put the first grouping separator (e.g. thousands). Zero means no separator (also no secondary separator!). - secondaryGroupingSize: Where to put the second grouping separators (used after the primary separator - eg for primaryGroupingSize set to 3 and secondaryGroupingSize set to 2, number 123456789 will be 12,34,56,789). For most languages, this is the same as primaryGroupingSize. - rounding: If set, number will be rounded to the multiple of this value. Can be float or integer. Zero means no rounding. Note: there can be characters in prefix / suffix elements which will be localized during formatting (eg minus sign, percent etc), or other chars which will be used as-is.
protected array $parsedFormats
리턴 array

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

As for one locale there can be defined many formats (at most 3 format types supported by this class - decimal, percent, currency - multiplied by at most 5 format lengths - full, long, medium, short, and implicit length referred in this class as 'default'), references are organized in arrays. Example of data stored in this array: 'pl' => array( 'decimal' => array( 'default' => '#,##0.###', ... ), ... );
protected array $parsedFormatsIndices
리턴 array