| Conditions | 2 |
| Paths | 2 |
| Total Lines | 11 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 19 | 9 | public function getPaymentAmount(float $presentValue, float $ratePerPeriod, float $numberOfPeriods): float |
|
| 20 | { |
||
| 21 | 9 | if ($ratePerPeriod > 0) { |
|
| 22 | 5 | $payment = (($ratePerPeriod / 100) * $presentValue) / (1 - pow(1 + ($ratePerPeriod / 100), |
|
| 23 | 5 | -$numberOfPeriods)); |
|
| 24 | } else { |
||
| 25 | 4 | $payment = $presentValue / $numberOfPeriods; |
|
| 26 | } |
||
| 27 | |||
| 28 | 9 | return $payment; |
|
| 29 | } |
||
| 30 | } |
||
| 31 |