1 | <?php |
||
9 | class EqualPrincipalPaymentAmountCalculator implements PaymentAmountCalculatorInterface |
||
10 | { |
||
11 | /** |
||
12 | * @param array $periods |
||
13 | * @param float $presentValue |
||
14 | * @param float $interestRate |
||
15 | * @param float $futureValue |
||
16 | * @return array |
||
17 | 5 | */ |
|
18 | public function getPaymentAmounts( |
||
44 | |||
45 | /** |
||
46 | * @param $interestRate |
||
47 | * @param $periodLength |
||
48 | * @return float|int |
||
49 | */ |
||
50 | private function getPeriodInterestRate($interestRate, $periodLength) |
||
54 | |||
55 | /** |
||
56 | * @param $presentValue |
||
57 | * @param $futureValue |
||
58 | * @param $noOfPeriods |
||
59 | * @return float|int |
||
60 | */ |
||
61 | private function getPrincipalPart($presentValue, $futureValue, $noOfPeriods) |
||
65 | |||
66 | /** |
||
67 | * @param float $presentValue |
||
68 | * @param float $futureValue |
||
69 | * @param float $ratePerPeriod |
||
70 | * @param float $numberOfPeriods |
||
71 | * @return float |
||
72 | */ |
||
73 | private function getPaymentAmount( |
||
89 | } |
||
90 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.