class MoneyToLocalizedStringTransformer extends NumberToLocalizedStringTransformer
Transforms between a normalized format and a localized money string.
| 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. |
| protected | $grouping | from NumberToLocalizedStringTransformer | |
| protected | $roundingMode | from NumberToLocalizedStringTransformer |
| __construct(int $scale = 2, bool|null $grouping = true, int|null $roundingMode = self::ROUND_HALF_UP, int|null $divisor = 1) | ||
| mixed | transform(mixed $value) Transforms a normalized format into a localized money string. | |
| mixed | reverseTransform(mixed $value) Transforms a localized money string into a normalized format. | |
| NumberFormatter | getNumberFormatter() Returns a preconfigured \NumberFormatter instance. | from NumberToLocalizedStringTransformer |
| int | $scale | |
| bool|null | $grouping | |
| int|null | $roundingMode | |
| int|null | $divisor |
Transforms a normalized format into a localized money string.
| mixed | $value | The value in the original representation |
| mixed | The value in the transformed representation |
| TransformationFailedException | if the given value is not numeric or if the value can not be transformed |
Transforms a localized money string into a normalized format.
| mixed | $value | The value in the transformed representation |
| mixed | The value in the original representation |
| TransformationFailedException | if the given value is not a string or if the value can not be transformed |
Returns a preconfigured \NumberFormatter instance.
| NumberFormatter |
© 2004–2017 Fabien Potencier
Licensed under the MIT License.
https://api.symfony.com/4.1/Symfony/Component/Form/Extension/Core/DataTransformer/MoneyToLocalizedStringTransformer.html