InitSofortConverter::createResponseTransfer()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 19
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 15
dl 0
loc 19
rs 9.7666
c 0
b 0
f 0
cc 1
nc 1
nop 2
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\Yves\Computop\Converter;
9
10
use Generated\Shared\Transfer\ComputopApiResponseHeaderTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...iResponseHeaderTransfer 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\ComputopSofortInitResponseTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...ortInitResponseTransfer 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 SprykerEco\Shared\Computop\Config\ComputopApiConfig;
13
14
class InitSofortConverter extends AbstractInitConverter
15
{
16
    /**
17
     * @param array $decryptedArray
18
     * @param \Generated\Shared\Transfer\ComputopApiResponseHeaderTransfer $header
19
     *
20
     * @return \Spryker\Shared\Kernel\Transfer\TransferInterface
21
     */
22
    protected function createResponseTransfer(array $decryptedArray, ComputopApiResponseHeaderTransfer $header)
23
    {
24
        $responseTransfer = new ComputopSofortInitResponseTransfer();
25
        $responseTransfer->fromArray($decryptedArray, true);
26
        $responseTransfer->setHeader($header);
27
        $responseTransfer->setAccountBank($this->computopApiService->getResponseValue($decryptedArray, ComputopApiConfig::ACCOUNT_BANK));
28
        $responseTransfer->setAccountOwner($this->computopApiService->getResponseValue($decryptedArray, ComputopApiConfig::ACCOUNT_OWNER));
29
        $responseTransfer->setBankAccountBic($this->computopApiService->getResponseValue($decryptedArray, ComputopApiConfig::BANK_ACCOUNT_BIC));
30
        $responseTransfer->setBankAccountIban($this->computopApiService->getResponseValue($decryptedArray, ComputopApiConfig::BANK_ACCOUNT_IBAN));
31
        //optional fields
32
        $responseTransfer->setFirstName($this->computopApiService->getResponseValue($decryptedArray, ComputopApiConfig::FIRST_NAME));
33
        $responseTransfer->setLastName($this->computopApiService->getResponseValue($decryptedArray, ComputopApiConfig::LAST_NAME));
34
        $responseTransfer->setAddressStreet($this->computopApiService->getResponseValue($decryptedArray, ComputopApiConfig::ADDRESS_STREET));
35
        $responseTransfer->setAddressCity($this->computopApiService->getResponseValue($decryptedArray, ComputopApiConfig::ADDRESS_CITY));
36
        $responseTransfer->setAddressZip($this->computopApiService->getResponseValue($decryptedArray, ComputopApiConfig::ADDRESS_ZIP));
37
        $responseTransfer->setBirthday($this->computopApiService->getResponseValue($decryptedArray, ComputopApiConfig::BIRTHDAY));
38
        $responseTransfer->setAge($this->computopApiService->getResponseValue($decryptedArray, ComputopApiConfig::AGE));
39
40
        return $responseTransfer;
41
    }
42
}
43