Conditions | 2 |
Paths | 2 |
Total Lines | 9 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php declare(strict_types=1); |
||
28 | 5 | private static function formatDecimalNumber(string $number, array $attributes): string |
|
29 | { |
||
30 | 5 | $parts = explode('.', $number); |
|
31 | 5 | if (strlen($parts[0]) > $attributes['scale']) { |
|
32 | 1 | $parts[0] = str_repeat('9', $attributes['scale']); |
|
33 | } |
||
34 | 5 | $number = $parts[0] . '.' . ($parts[1] ?? ''); |
|
35 | |||
36 | 5 | return bcadd($number, '0', $attributes['precision']); |
|
37 | } |
||
39 |