AbstractInitConverter::getResponseTransfer()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 14
rs 9.9666
c 0
b 0
f 0
cc 1
nc 1
nop 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\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 SprykerEco\Service\ComputopApi\ComputopApiServiceInterface;
12
use SprykerEco\Shared\Computop\ComputopConfig;
13
14
abstract class AbstractInitConverter implements ConverterInterface
15
{
16
    /**
17
     * @var \SprykerEco\Service\ComputopApi\ComputopApiServiceInterface
18
     */
19
    protected $computopApiService;
20
21
    /**
22
     * @var \SprykerEco\Yves\Computop\ComputopConfig
23
     */
24
    protected $config;
25
26
    /**
27
     * @param array $decryptedArray
28
     * @param \Generated\Shared\Transfer\ComputopApiResponseHeaderTransfer $header
29
     *
30
     * @return \Spryker\Shared\Kernel\Transfer\TransferInterface
31
     */
32
    abstract protected function createResponseTransfer(array $decryptedArray, ComputopApiResponseHeaderTransfer $header);
33
34
    /**
35
     * @param \SprykerEco\Service\ComputopApi\ComputopApiServiceInterface $computopApiService
36
     * @param \SprykerEco\Yves\Computop\ComputopConfig $config
37
     */
38
    public function __construct(ComputopApiServiceInterface $computopApiService, $config)
39
    {
40
        $this->computopApiService = $computopApiService;
41
        $this->config = $config;
42
    }
43
44
    /**
45
     * @param array $responseHeader
46
     *
47
     * @return \Spryker\Shared\Kernel\Transfer\TransferInterface
48
     */
49
    public function getResponseTransfer(array $responseHeader)
50
    {
51
        $decryptedArray = $this
52
            ->computopApiService
53
            ->decryptResponseHeader($responseHeader, $this->config->getBlowfishPassword());
54
55
        $responseHeaderTransfer = $this
56
            ->computopApiService
57
            ->extractResponseHeader(
58
                $decryptedArray,
59
                ComputopConfig::INIT_METHOD
60
            );
61
62
        return $this->createResponseTransfer($decryptedArray, $responseHeaderTransfer);
63
    }
64
}
65