InstallmentDetailMapper   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 13
c 1
b 0
f 0
dl 0
loc 43
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A map() 0 8 1
A __construct() 0 8 1
1
<?php
2
3
/**
4
 * MIT License
5
 * Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
6
 */
7
8
namespace SprykerEco\Zed\Ratepay\Business\Api\Mapper;
9
10
use Generated\Shared\Transfer\RatepayPaymentRequestTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...yPaymentRequestTransfer was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
11
use Generated\Shared\Transfer\RatepayRequestInstallmentDetailsTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...tallmentDetailsTransfer was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
12
use Generated\Shared\Transfer\RatepayRequestTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\RatepayRequestTransfer was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
13
use SprykerEco\Zed\Ratepay\Dependency\Facade\RatepayToMoneyInterface;
14
15
class InstallmentDetailMapper extends BaseMapper
16
{
17
    /**
18
     * @var \Generated\Shared\Transfer\RatepayPaymentRequestTransfer
19
     */
20
    protected $ratepayPaymentRequestTransfer;
21
22
    /**
23
     * @var \Generated\Shared\Transfer\RatepayRequestTransfer
24
     */
25
    protected $requestTransfer;
26
27
    /**
28
     * @var \SprykerEco\Zed\Ratepay\Dependency\Facade\RatepayToMoneyInterface
29
     */
30
    protected $moneyFacade;
31
32
    /**
33
     * @param \Generated\Shared\Transfer\RatepayPaymentRequestTransfer $ratepayPaymentRequestTransfer
34
     * @param \Generated\Shared\Transfer\RatepayRequestTransfer $requestTransfer
35
     * @param \SprykerEco\Zed\Ratepay\Dependency\Facade\RatepayToMoneyInterface $moneyFacade
36
     */
37
    public function __construct(
38
        RatepayPaymentRequestTransfer $ratepayPaymentRequestTransfer,
39
        RatepayRequestTransfer $requestTransfer,
40
        RatepayToMoneyInterface $moneyFacade
41
    ) {
42
        $this->ratepayPaymentRequestTransfer = $ratepayPaymentRequestTransfer;
43
        $this->requestTransfer = $requestTransfer;
44
        $this->moneyFacade = $moneyFacade;
45
    }
46
47
    /**
48
     * @return void
49
     */
50
    public function map()
51
    {
52
        $this->requestTransfer->setInstallmentDetails(new RatepayRequestInstallmentDetailsTransfer())->getInstallmentDetails()
53
            ->setRatesNumber($this->ratepayPaymentRequestTransfer->getInstallmentNumberRates())
54
            ->setAmount($this->moneyFacade->convertIntegerToDecimal((int)$this->ratepayPaymentRequestTransfer->getInstallmentRate()))
55
            ->setLastAmount($this->moneyFacade->convertIntegerToDecimal((int)$this->ratepayPaymentRequestTransfer->getInstallmentLastRate()))
56
            ->setInterestRate($this->moneyFacade->convertIntegerToDecimal((int)$this->ratepayPaymentRequestTransfer->getInstallmentInterestRate()))
57
            ->setPaymentFirstday($this->ratepayPaymentRequestTransfer->getInstallmentPaymentFirstDay());
58
    }
59
}
60