| Conditions | 2 |
| Paths | 2 |
| Total Lines | 13 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 23 | public function __construct(float $rate) |
||
| 24 | { |
||
| 25 | $fmtPercent = new NumberFormatter('fr_FR', NumberFormatter::PERCENT); |
||
| 26 | $fmtPercent->setAttribute($fmtPercent::FRACTION_DIGITS, 2); |
||
| 27 | |||
| 28 | $this->rate = $rate / 100; |
||
| 29 | |||
| 30 | $fraction = \explode('.', (string) $rate); |
||
| 31 | if (\strlen($fraction[1]) > 2) { |
||
| 32 | $this->rate = $rate; |
||
| 33 | } |
||
| 34 | |||
| 35 | $this->name = $fmtPercent->format($this->rate); |
||
| 36 | } |
||
| 61 |