Conditions | 2 |
Paths | 2 |
Total Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
55 | 2 | public function getFormattedAmount( |
|
56 | string $locale = null |
||
57 | ): string { |
||
58 | 2 | if ($locale === null) { |
|
59 | 1 | $locale = Locale::getDefault(); |
|
60 | } |
||
61 | |||
62 | 2 | $numberFormatter = new NumberFormatter($locale, NumberFormatter::DECIMAL); |
|
63 | 2 | $fractionDigits = $this->currency->getFractionDigits(); |
|
64 | 2 | $numberFormatter->setAttribute(NumberFormatter::MIN_FRACTION_DIGITS, $fractionDigits); |
|
65 | 2 | $numberFormatter->setAttribute(NumberFormatter::MAX_FRACTION_DIGITS, $fractionDigits); |
|
66 | |||
67 | 2 | return $numberFormatter->format($this->amount); |
|
68 | } |
||
69 | |||
75 |