Conditions | 1 |
Paths | 1 |
Total Lines | 14 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 1 |
Changes | 3 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
55 | 2 | public function format(Collection $items): string |
|
56 | { |
||
57 | 2 | $formatter = new NumberFormatter( |
|
58 | 2 | $items->get($this->locale_key) ?? app()->getLocale(), |
|
|
|||
59 | 2 | $items->get($this->style_key) ?? NumberFormatter::DECIMAL |
|
60 | ); |
||
61 | |||
62 | 2 | $formatter->setAttribute( |
|
63 | 2 | NumberFormatter::FRACTION_DIGITS, |
|
64 | 2 | $this->fraction_digits |
|
65 | ); |
||
66 | |||
67 | 2 | return $formatter->format( |
|
68 | 2 | (float) $items->get($this->number_key) ?? $this->default_number |
|
69 | ); |
||
72 |