InstallmentPaymentMapper   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A map() 0 6 1
A __construct() 0 9 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\RatepayRequestInstallmentPaymentTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...tallmentPaymentTransfer 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 InstallmentPaymentMapper 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
43
        $this->ratepayPaymentRequestTransfer = $ratepayPaymentRequestTransfer;
44
        $this->requestTransfer = $requestTransfer;
45
        $this->moneyFacade = $moneyFacade;
46
    }
47
48
    /**
49
     * @return void
50
     */
51
    public function map()
52
    {
53
        $this->requestTransfer->setInstallmentPayment(new RatepayRequestInstallmentPaymentTransfer())->getInstallmentPayment()
54
            ->setDebitPayType($this->ratepayPaymentRequestTransfer->getDebitPayType())
55
            ->setAmount(
56
                $this->moneyFacade->convertIntegerToDecimal((int)$this->ratepayPaymentRequestTransfer->getInstallmentGrandTotalAmount())
57
            );
58
    }
59
}
60