IntegerToLocalizedStringTransformer
class IntegerToLocalizedStringTransformer extends NumberToLocalizedStringTransformer
Transforms between an integer and a localized number with grouping (each thousand) and comma separators.
Constants
ROUND_CEILING |
Rounds a number towards positive infinity. Rounds 1.4 to 2 and -1.4 to -1. |
ROUND_FLOOR |
Rounds a number towards negative infinity. Rounds 1.4 to 1 and -1.4 to -2. |
ROUND_UP |
Rounds a number away from zero. Rounds 1.4 to 2 and -1.4 to -2. |
ROUND_DOWN |
Rounds a number towards zero. Rounds 1.4 to 1 and -1.4 to -1. |
ROUND_HALF_EVEN |
Rounds to the nearest number and halves to the next even number. Rounds 2.5, 1.6 and 1.5 to 2 and 1.4 to 1. |
ROUND_HALF_UP |
Rounds to the nearest number and halves away from zero. Rounds 2.5 to 3, 1.6 and 1.5 to 2 and 1.4 to 1. |
ROUND_HALF_DOWN |
Rounds to the nearest number and halves towards zero. Rounds 2.5 and 1.6 to 2, 1.5 and 1.4 to 1. |
Properties
protected | $grouping | from NumberToLocalizedStringTransformer | |
protected | $roundingMode | from NumberToLocalizedStringTransformer |
Methods
Constructs a transformer.
Transforms a number type into localized number.
Transforms a localized number into an integer or float.
Returns a preconfigured \NumberFormatter instance.
No description
Details
at line 28
__construct(bool|null $grouping = false, int|null $roundingMode = self::ROUND_DOWN)
Constructs a transformer.
in NumberToLocalizedStringTransformer at line 106
mixed
transform(mixed $value)
Transforms a number type into localized number.
at line 43
mixed
reverseTransform(mixed $value)
Transforms a localized number into an integer or float.
in NumberToLocalizedStringTransformer at line 215
protected NumberFormatter
getNumberFormatter()
Returns a preconfigured \NumberFormatter instance.