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