[Intl] Add `Currencies::getCashFractionDigits()` and `Currencies::getCashRoundingIncrement()`
MODIFY
CHANGELOG.md
CHANGELOG.md
CHANGELOG
=========
+5.3
+---
+
+ * Add `Currencies::getCashFractionDigits()` and `Currencies::getCashRoundingIncrement()`
+
5.0.0
-----

MODIFY
Currencies.php
Currencies.php
@@ -25,6 +25,8 @@ final class Currencies extends ResourceBundle
private const INDEX_NAME = 1;
private const INDEX_FRACTION_DIGITS = 0;
private const INDEX_ROUNDING_INCREMENT = 1;
+ private const INDEX_CASH_FRACTION_DIGITS = 2;
+ private const INDEX_CASH_ROUNDING_INCREMENT = 3;
/**
* @return string[]
@@ -94,10 +96,7 @@ final class Currencies extends ResourceBundle
}
}
- /**
- * @return float|int
- */
- public static function getRoundingIncrement(string $currency)
+ public static function getRoundingIncrement(string $currency): int
{
try {
return self::readEntry(['Meta', $currency, self::INDEX_ROUNDING_INCREMENT], 'meta');
@@ -106,6 +105,24 @@ final class Currencies extends ResourceBundle
}
}
+ public static function getCashFractionDigits(string $currency): int
+ {
+ try {
+ return self::readEntry(['Meta', $currency, self::INDEX_CASH_FRACTION_DIGITS], 'meta');
+ } catch (MissingResourceException $e) {
+ return self::readEntry(['Meta', 'DEFAULT', self::INDEX_CASH_FRACTION_DIGITS], 'meta');
+ }
+ }
+
+ public static function getCashRoundingIncrement(string $currency): int
+ {
+ try {
+ return self::readEntry(['Meta', $currency, self::INDEX_CASH_ROUNDING_INCREMENT], 'meta');
+ } catch (MissingResourceException $e) {
+ return self::readEntry(['Meta', 'DEFAULT', self::INDEX_CASH_ROUNDING_INCREMENT], 'meta');
+ }
+ }
+
/**
* @throws MissingResourceException if the currency code has no numeric code
*/

[Intl] Add `Currencies::getCashFractionDigits()` and `Currencies::getCashRoundingIncrement()`