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 | 8 | private function getCurrentPeriod($period, int $calculationType, int $calculateFor) |
|
86 | |||
87 | /** |
||
88 | * @param PeriodInterface $period |
||
89 | * @param int $calculationType |
||
90 | * @param int $calculateFor |
||
91 | * @return float |
||
92 | * @throws \Exception |
||
93 | */ |
||
94 | 12 | public function getNumberOfPeriods( |
|
125 | |||
126 | /** |
||
127 | * @return int |
||
128 | */ |
||
129 | 10 | public function getExactPeriodsLength() |
|
141 | |||
142 | /** |
||
143 | * @return int |
||
144 | */ |
||
145 | 10 | public function getAveragePeriodsLength() |
|
152 | |||
153 | /** |
||
154 | * @return array |
||
155 | */ |
||
156 | 19 | public function getPeriods(): array |
|
160 | |||
161 | /** |
||
162 | * @return int |
||
163 | */ |
||
164 | 16 | public function getNoOfPeriods(): int |
|
168 | |||
169 | |||
170 | } |
||
171 |