ProfileResponseConverter::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 3
dl 0
loc 8
rs 10
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\Converter;
9
10
use Generated\Shared\Transfer\RatepayProfileResponseTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...ProfileResponseTransfer 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 SprykerEco\Zed\Ratepay\Business\Api\Constants;
12
use SprykerEco\Zed\Ratepay\Business\Api\Model\Response\ResponseInterface;
13
use SprykerEco\Zed\Ratepay\Dependency\Facade\RatepayToMoneyInterface;
14
15
class ProfileResponseConverter extends BaseConverter
16
{
17
    /**
18
     * @var \SprykerEco\Zed\Ratepay\Business\Api\Converter\TransferObjectConverter
19
     */
20
    protected $responseTransfer;
21
22
    /**
23
     * @param \SprykerEco\Zed\Ratepay\Business\Api\Model\Response\ResponseInterface $response
24
     * @param \SprykerEco\Zed\Ratepay\Dependency\Facade\RatepayToMoneyInterface $moneyFacade
25
     * @param \SprykerEco\Zed\Ratepay\Business\Api\Converter\TransferObjectConverter $responseTransferConverter
26
     */
27
    public function __construct(
28
        ResponseInterface $response,
29
        RatepayToMoneyInterface $moneyFacade,
30
        TransferObjectConverter $responseTransferConverter
31
    ) {
32
        parent::__construct($response, $moneyFacade);
33
34
        $this->responseTransfer = $responseTransferConverter;
35
    }
36
37
    /**
38
     * @return \Generated\Shared\Transfer\RatepayProfileResponseTransfer
39
     */
40
    public function convert()
41
    {
42
        $baseResponse = $this->responseTransfer->convert();
43
44
        $responseTransfer = new RatepayProfileResponseTransfer();
45
        $responseTransfer
46
            ->setBaseResponse($baseResponse);
47
48
        $successCode = Constants::REQUEST_CODE_SUCCESS_MATRIX[Constants::REQUEST_MODEL_PROFILE];
49
        if ($successCode == $baseResponse->getResultCode()) {
50
            $responseTransfer
51
                ->setMasterData($this->response->getMasterData())
0 ignored issues
show
Bug introduced by
The method getMasterData() does not exist on SprykerEco\Zed\Ratepay\B...ponse\ResponseInterface. It seems like you code against a sub-type of SprykerEco\Zed\Ratepay\B...ponse\ResponseInterface such as SprykerEco\Zed\Ratepay\B...esponse\ProfileResponse. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

51
                ->setMasterData($this->response->/** @scrutinizer ignore-call */ getMasterData())
Loading history...
52
                ->setInstallmentConfigurationResult($this->response->getInstallmentConfigurationResult());
0 ignored issues
show
Bug introduced by
The method getInstallmentConfigurationResult() does not exist on SprykerEco\Zed\Ratepay\B...ponse\ResponseInterface. It seems like you code against a sub-type of SprykerEco\Zed\Ratepay\B...ponse\ResponseInterface such as SprykerEco\Zed\Ratepay\B...esponse\ProfileResponse. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

52
                ->setInstallmentConfigurationResult($this->response->/** @scrutinizer ignore-call */ getInstallmentConfigurationResult());
Loading history...
53
        }
54
55
        return $responseTransfer;
56
    }
57
}
58