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