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