PHP Class Prado\I18N\core\NumberFormatInfo

Defines how numeric values are formatted and displayed, depending on the culture. Numeric values are formatted using standard or custom patterns stored in the properties of a NumberFormatInfo. This class contains information, such as currency, decimal separators, and other numeric symbols. To create a NumberFormatInfo for a specific culture, create a CultureInfo for that culture and retrieve the CultureInfo->NumberFormat property. Or use NumberFormatInfo::getInstance($culture). To create a NumberFormatInfo for the invariant culture, use the InvariantInfo::getInvariantInfo().
Afficher le fichier Open project: pradosoft/prado Class Usage Examples

Protected Properties

Свойство Type Description
$pattern array The number pattern.
$properties array A list of properties that are accessable/writable.

Méthodes publiques

Méthode Description
__construct ( $data = [], $type = NumberFormatInfo::DECIMAL ) Initializes a new writable instance of the NumberFormatInfo class that is dependent on the ICU data for number, decimal, and currency formatting information. N.B.You should not initialize this class directly unless you know what you are doing. Please use use NumberFormatInfo::getInstance() to create an instance.
__get ( $name ) : mixed Allow functions that begins with 'set' to be called directly as an attribute/property to retrieve the value.
__set ( $name, $value ) Allow functions that begins with 'set' to be called directly as an attribute/property to set the value.
getCurrencyInstance ( $culture = null ) : NumberFormatInfo Returns the currency format info associated with the specified culture.
getCurrencySymbol ( $currency = 'USD' ) : string Gets the string to use as the currency symbol.
getDecimalDigits ( ) : integer Indicates the number of decimal places.
getDecimalSeparator ( ) : string Gets the string to use as the decimal separator.
getDigitSize ( )
getGroupSeparator ( ) : string Gets the string that separates groups of digits to the left of the decimal in currency values.
getGroupSizes ( ) : array Gets the number of digits in each group to the left of the decimal There can be two grouping sizes, this fucntion returns array(group1, group2), if there is only 1 grouping size, group2 will be false.
getInstance ( $culture = null, $type = NumberFormatInfo::DECIMAL ) : NumberFormatInfo Returns the NumberFormatInfo associated with the specified culture.
getInvariantInfo ( $type = NumberFormatInfo::DECIMAL ) : NumberFormatInfo Gets the default NumberFormatInfo that is culture-independent (invariant).
getNaNSymbol ( ) : string Gets the string that represents the IEEE NaN (not a number) value.
getNegativeInfinitySymbol ( ) : string Gets the string that represents negative infinity.
getNegativePattern ( ) : arary Gets the format pattern for negative values.
getNegativeSign ( ) : string Gets the string that denotes that the associated number is negative.
getPattern ( )
getPerMilleSymbol ( ) : string Gets the string to use as the per mille symbol.
getPercentSymbol ( ) : string Gets the string to use as the percent symbol.
getPercentageInstance ( $culture = null ) : NumberFormatInfo Returns the percentage format info associated with the specified culture.
getPositiveInfinitySymbol ( ) : string Gets the string that represents positive infinity.
getPositivePattern ( ) : arary Gets the format pattern for positive values.
getPositiveSign ( ) : string Gets the string that denotes that the associated number is positive.
getScientificInstance ( $culture = null ) : NumberFormatInfo Returns the scientific format info associated with the specified culture.
setCurrencySymbol ( $symbol ) Set the string to use as the currency symbol.
setDecimalDigits ( $value ) Set the number of decimal places.
setDecimalSeparator ( $value ) Set the string to use as the decimal separator.
setDigitSize ( $value )
setGroupSeparator ( $value ) Set the string to use as the group separator.
setGroupSizes ( $groupSize ) Set the number of digits in each group to the left of the decimal.
setNaNSymbol ( $value ) Set the string that represents the IEEE NaN (not a number) value.
setNegativeInfinitySymbol ( $value ) Set the string that represents negative infinity.
setNegativePattern ( $pattern ) Set the format pattern for negative values.
setNegativeSign ( $value ) Set the string that denotes that the associated number is negative.
setPattern ( $type = NumberFormatInfo::DECIMAL ) Set the pattern for a specific number pattern. The validate patterns NumberFormatInfo::DECIMAL, NumberFormatInfo::CURRENCY, NumberFormatInfo::PERCENTAGE, or NumberFormatInfo::SCIENTIFIC
setPerMilleSymbol ( $value ) Set the string to use as the per mille symbol.
setPercentSymbol ( $value ) Set the string to use as the percent symbol.
setPositiveInfinitySymbol ( $value ) Set the string that represents positive infinity.
setPositivePattern ( $pattern ) Set the format pattern for positive values.
setPositiveSign ( $value ) Set the string that denotes that the associated number is positive.

Méthodes protégées

Méthode Description
getPrePostfix ( $pattern ) : array Get the prefix and postfix of a pattern.
parsePattern ( $pattern ) : array Parse the given pattern and return a list of known properties.

Method Details

__construct() public méthode

Initializes a new writable instance of the NumberFormatInfo class that is dependent on the ICU data for number, decimal, and currency formatting information. N.B.You should not initialize this class directly unless you know what you are doing. Please use use NumberFormatInfo::getInstance() to create an instance.
See also: getInstance()
public __construct ( $data = [], $type = NumberFormatInfo::DECIMAL )

__get() public méthode

Allow functions that begins with 'set' to be called directly as an attribute/property to retrieve the value.
public __get ( $name ) : mixed
Résultat mixed

__set() public méthode

Allow functions that begins with 'set' to be called directly as an attribute/property to set the value.
public __set ( $name, $value )

getCurrencyInstance() public static méthode

Returns the currency format info associated with the specified culture.
public static getCurrencyInstance ( $culture = null ) : NumberFormatInfo
Résultat NumberFormatInfo NumberFormatInfo for the specified culture.

getCurrencySymbol() public méthode

Gets the string to use as the currency symbol.
public getCurrencySymbol ( $currency = 'USD' ) : string
Résultat string currency symbol.

getDecimalDigits() public méthode

Indicates the number of decimal places.
public getDecimalDigits ( ) : integer
Résultat integer number of decimal places.

getDecimalSeparator() public méthode

Gets the string to use as the decimal separator.
public getDecimalSeparator ( ) : string
Résultat string decimal separator.

getDigitSize() public méthode

public getDigitSize ( )

getGroupSeparator() public méthode

Gets the string that separates groups of digits to the left of the decimal in currency values.
public getGroupSeparator ( ) : string
Résultat string currency group separator.

getGroupSizes() public méthode

Gets the number of digits in each group to the left of the decimal There can be two grouping sizes, this fucntion returns array(group1, group2), if there is only 1 grouping size, group2 will be false.
public getGroupSizes ( ) : array
Résultat array grouping size(s).

getInstance() public static méthode

Returns the NumberFormatInfo associated with the specified culture.
public static getInstance ( $culture = null, $type = NumberFormatInfo::DECIMAL ) : NumberFormatInfo
Résultat NumberFormatInfo NumberFormatInfo for the specified culture.

getInvariantInfo() public static méthode

Gets the default NumberFormatInfo that is culture-independent (invariant).
public static getInvariantInfo ( $type = NumberFormatInfo::DECIMAL ) : NumberFormatInfo
Résultat NumberFormatInfo default NumberFormatInfo.

getNaNSymbol() public méthode

Gets the string that represents the IEEE NaN (not a number) value.
public getNaNSymbol ( ) : string
Résultat string NaN symbol.

getNegativeInfinitySymbol() public méthode

Gets the string that represents negative infinity.
public getNegativeInfinitySymbol ( ) : string
Résultat string negative infinity.

getNegativePattern() public méthode

The negative pattern is composed of a prefix, and postfix. This function returns array(prefix, postfix).
public getNegativePattern ( ) : arary
Résultat arary negative pattern.

getNegativeSign() public méthode

Gets the string that denotes that the associated number is negative.
public getNegativeSign ( ) : string
Résultat string negative sign.

getPattern() public méthode

public getPattern ( )

getPerMilleSymbol() public méthode

Gets the string to use as the per mille symbol.
public getPerMilleSymbol ( ) : string
Résultat string percent symbol.

getPercentSymbol() public méthode

Gets the string to use as the percent symbol.
public getPercentSymbol ( ) : string
Résultat string percent symbol.

getPercentageInstance() public static méthode

Returns the percentage format info associated with the specified culture.
public static getPercentageInstance ( $culture = null ) : NumberFormatInfo
Résultat NumberFormatInfo NumberFormatInfo for the specified culture.

getPositiveInfinitySymbol() public méthode

Gets the string that represents positive infinity.
public getPositiveInfinitySymbol ( ) : string
Résultat string positive infinity.

getPositivePattern() public méthode

The positive pattern is composed of a prefix, and postfix. This function returns array(prefix, postfix).
public getPositivePattern ( ) : arary
Résultat arary positive pattern.

getPositiveSign() public méthode

Gets the string that denotes that the associated number is positive.
public getPositiveSign ( ) : string
Résultat string positive sign.

getPrePostfix() protected méthode

Get the prefix and postfix of a pattern.
protected getPrePostfix ( $pattern ) : array
Résultat array of prefix and postfix, array(prefix,postfix).

getScientificInstance() public static méthode

Returns the scientific format info associated with the specified culture.
public static getScientificInstance ( $culture = null ) : NumberFormatInfo
Résultat NumberFormatInfo NumberFormatInfo for the specified culture.

parsePattern() protected méthode

Parse the given pattern and return a list of known properties.
protected parsePattern ( $pattern ) : array
Résultat array list of pattern properties.

setCurrencySymbol() public méthode

Set the string to use as the currency symbol.
public setCurrencySymbol ( $symbol )

setDecimalDigits() public méthode

Set the number of decimal places.
public setDecimalDigits ( $value )

setDecimalSeparator() public méthode

Set the string to use as the decimal separator.
public setDecimalSeparator ( $value )

setDigitSize() public méthode

public setDigitSize ( $value )

setGroupSeparator() public méthode

Set the string to use as the group separator.
public setGroupSeparator ( $value )

setGroupSizes() public méthode

There can be two grouping sizes, the value should be an array(group1, group2), if there is only 1 grouping size, group2 should be false.
public setGroupSizes ( $groupSize )

setNaNSymbol() public méthode

Set the string that represents the IEEE NaN (not a number) value.
public setNaNSymbol ( $value )

setNegativeInfinitySymbol() public méthode

Set the string that represents negative infinity.
public setNegativeInfinitySymbol ( $value )

setNegativePattern() public méthode

The negative pattern is composed of a prefix, and postfix in the form array(prefix, postfix).
public setNegativePattern ( $pattern )

setNegativeSign() public méthode

Set the string that denotes that the associated number is negative.
public setNegativeSign ( $value )

setPattern() public méthode

Set the pattern for a specific number pattern. The validate patterns NumberFormatInfo::DECIMAL, NumberFormatInfo::CURRENCY, NumberFormatInfo::PERCENTAGE, or NumberFormatInfo::SCIENTIFIC
public setPattern ( $type = NumberFormatInfo::DECIMAL )

setPerMilleSymbol() public méthode

Set the string to use as the per mille symbol.
public setPerMilleSymbol ( $value )

setPercentSymbol() public méthode

Set the string to use as the percent symbol.
public setPercentSymbol ( $value )

setPositiveInfinitySymbol() public méthode

Set the string that represents positive infinity.
public setPositiveInfinitySymbol ( $value )

setPositivePattern() public méthode

The positive pattern is composed of a prefix, and postfix in the form array(prefix, postfix).
public setPositivePattern ( $pattern )

setPositiveSign() public méthode

Set the string that denotes that the associated number is positive.
public setPositiveSign ( $value )

Property Details

$pattern protected_oe property

The number pattern.
protected array $pattern
Résultat array

$properties protected_oe property

A list of properties that are accessable/writable.
protected array $properties
Résultat array