number_format->value; [$decimalMark, $thousandsSeparator] = NumberFormat::from($format)->getFormattingParameters(); $floatValue = (float) str_replace([$thousandsSeparator, $decimalMark], ['', '.'], $value); return (int) round($floatValue * self::SCALING_FACTOR); } public static function formatScaledRate(int $scaledRate): string { $format = Localization::firstOrFail()->number_format->value; [$decimalMark, $thousandsSeparator] = NumberFormat::from($format)->getFormattingParameters(); $percentageValue = $scaledRate / self::SCALING_FACTOR; $formatted = number_format($percentageValue, self::PRECISION, $decimalMark, $thousandsSeparator); $formatted = rtrim($formatted, '0'); return rtrim($formatted, $decimalMark); } }