1 | <?php |
||
11 | class PaymentPeriods implements PaymentPeriodsInterface |
||
12 | { |
||
13 | /** |
||
14 | * @var array |
||
15 | */ |
||
16 | private $periods = array(); |
||
17 | /** |
||
18 | * @var int |
||
19 | */ |
||
20 | private $averagePeriod; |
||
21 | |||
22 | /** |
||
23 | * PaymentPeriods constructor. |
||
24 | * @param int $averagePeriod |
||
25 | */ |
||
26 | 21 | public function __construct(int $averagePeriod) |
|
30 | |||
31 | /** |
||
32 | * @param PeriodInterface $period |
||
33 | * @param int|null $sequenceNo |
||
34 | */ |
||
35 | 19 | public function add(PeriodInterface $period, int $sequenceNo = null): void |
|
44 | |||
45 | /** |
||
46 | * @param PeriodInterface $period |
||
47 | * @param float $yearlyInterestRate |
||
48 | * @param int $calculationType |
||
49 | * @param int $calculateFor |
||
50 | * @return float |
||
51 | * @throws \Exception |
||
52 | */ |
||
53 | 9 | public function getRatePerPeriod( |
|
73 | |||
74 | /** |
||
75 | * @param PeriodInterface $period |
||
76 | * @param int $calculationType |
||
77 | * @param int $calculateFor |
||
78 | * @return float |
||
79 | * @throws \Exception |
||
80 | */ |
||
81 | 12 | public function getNumberOfPeriods( |
|
102 | |||
103 | /** |
||
104 | * @return int |
||
105 | */ |
||
106 | 10 | public function getExactPeriodsLength() |
|
118 | |||
119 | /** |
||
120 | * @return int |
||
121 | */ |
||
122 | 10 | public function getAveragePeriodsLength() |
|
129 | |||
130 | /** |
||
131 | * @return array |
||
132 | */ |
||
133 | 19 | public function getPeriods(): array |
|
137 | |||
138 | /** |
||
139 | * @return int |
||
140 | */ |
||
141 | 16 | public function getNoOfPeriods(): int |
|
145 | |||
146 | /** |
||
147 | * @param PeriodInterface $period |
||
148 | * @param int $calculationType |
||
149 | * @param int $calculateFor |
||
150 | * @return int |
||
151 | */ |
||
152 | 17 | private function getCurrentPeriod(PeriodInterface $period, int $calculationType, int $calculateFor) |
|
164 | |||
165 | /** |
||
166 | * @param int $calculationType |
||
167 | * @param int $calculateFor |
||
168 | * @return int |
||
169 | */ |
||
170 | 11 | private function getTotalPeriods(int $calculationType, int $calculateFor) |
|
182 | |||
183 | |||
184 | } |
||
185 |