| Total Complexity | 6 |
| Total Lines | 42 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 10 | class InstallmentCalculation extends AbstractBuilder implements InstallmentCalculationInterface |
||
| 11 | { |
||
| 12 | public const ROOT_TAG = 'installment-calculation'; |
||
| 13 | |||
| 14 | public const SUBTYPE_RATE = 'calculation-by-rate'; |
||
| 15 | public const SUBTYPE_TIME = 'calculation-by-time'; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * @return array |
||
| 19 | */ |
||
| 20 | public function buildData() |
||
| 21 | { |
||
| 22 | $return = [ |
||
| 23 | 'amount' => $this->requestTransfer->getInstallmentCalculation()->getAmount(), |
||
| 24 | ]; |
||
| 25 | if ($this->requestTransfer->getInstallmentCalculation()->getPaymentFirstday() !== null) { |
||
| 26 | $return['payment-firstday'] = $this->requestTransfer->getInstallmentCalculation()->getPaymentFirstday(); |
||
| 27 | } |
||
| 28 | if ($this->requestTransfer->getInstallmentCalculation()->getCalculationStart() !== null) { |
||
| 29 | $return['calculation-start'] = $this->requestTransfer->getInstallmentCalculation()->getCalculationStart(); |
||
| 30 | } |
||
| 31 | |||
| 32 | if ($this->requestTransfer->getInstallmentCalculation()->getSubType() == self::SUBTYPE_RATE) { |
||
| 33 | $return['calculation-rate'] = [ |
||
| 34 | 'rate' => $this->requestTransfer->getInstallmentCalculation()->getCalculationRate(), |
||
| 35 | ]; |
||
| 36 | } |
||
| 37 | if ($this->requestTransfer->getInstallmentCalculation()->getSubType() == self::SUBTYPE_TIME) { |
||
| 38 | $return['calculation-time'] = [ |
||
| 39 | 'month' => $this->requestTransfer->getInstallmentCalculation()->getMonth(), |
||
| 40 | ]; |
||
| 41 | } |
||
| 42 | |||
| 43 | return $return; |
||
| 44 | } |
||
| 45 | |||
| 46 | /** |
||
| 47 | * @return string |
||
| 48 | */ |
||
| 49 | public function getRootTag() |
||
| 52 | } |
||
| 53 | } |
||
| 54 |