Conditions | 2 |
Paths | 2 |
Total Lines | 13 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
65 | 2 | public function getFormattedAmount($locale = null) |
|
66 | { |
||
67 | 2 | if ($locale === null) { |
|
68 | 1 | $locale = Locale::getDefault(); |
|
69 | 1 | } |
|
70 | |||
71 | 2 | $numberFormatter = new NumberFormatter($locale, NumberFormatter::DECIMAL); |
|
72 | 2 | $fractionDigits = $this->currency->getFractionDigits(); |
|
73 | 2 | $numberFormatter->setAttribute(NumberFormatter::MIN_FRACTION_DIGITS, $fractionDigits); |
|
74 | 2 | $numberFormatter->setAttribute(NumberFormatter::MAX_FRACTION_DIGITS, $fractionDigits); |
|
75 | |||
76 | 2 | return $numberFormatter->format($this->amount); |
|
77 | } |
||
78 | |||
87 |