|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* MIT License |
|
5
|
|
|
* For full license information, please view the LICENSE file that was distributed with this source code. |
|
6
|
|
|
*/ |
|
7
|
|
|
|
|
8
|
|
|
namespace SprykerEco\Zed\CrefoPayApi\Business\Converter; |
|
9
|
|
|
|
|
10
|
|
|
use Generated\Shared\Transfer\CrefoPayApiResponseTransfer; |
|
|
|
|
|
|
11
|
|
|
use Psr\Http\Message\ResponseInterface; |
|
|
|
|
|
|
12
|
|
|
use SprykerEco\Zed\CrefoPayApi\Business\Validator\Response\CrefoPayApiResponseValidatorInterface; |
|
13
|
|
|
use SprykerEco\Zed\CrefoPayApi\Dependency\Service\CrefoPayApiToUtilEncodingServiceInterface; |
|
14
|
|
|
|
|
15
|
|
|
abstract class AbstractConverter implements CrefoPayApiConverterInterface |
|
16
|
|
|
{ |
|
17
|
|
|
/** |
|
18
|
|
|
* @var \SprykerEco\Zed\CrefoPayApi\Business\Validator\Response\CrefoPayApiResponseValidatorInterface |
|
19
|
|
|
*/ |
|
20
|
|
|
protected $validator; |
|
21
|
|
|
|
|
22
|
|
|
/** |
|
23
|
|
|
* @var \SprykerEco\Zed\CrefoPayApi\Dependency\Service\CrefoPayApiToUtilEncodingServiceInterface |
|
24
|
|
|
*/ |
|
25
|
|
|
protected $encodingService; |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* @param \Generated\Shared\Transfer\CrefoPayApiResponseTransfer $responseTransfer |
|
29
|
|
|
* @param array $responseData |
|
30
|
|
|
* |
|
31
|
|
|
* @return \Generated\Shared\Transfer\CrefoPayApiResponseTransfer |
|
32
|
|
|
*/ |
|
33
|
|
|
abstract protected function updateResponseTransferWithApiCallResponse( |
|
34
|
|
|
CrefoPayApiResponseTransfer $responseTransfer, |
|
35
|
|
|
array $responseData |
|
36
|
|
|
): CrefoPayApiResponseTransfer; |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* @param \SprykerEco\Zed\CrefoPayApi\Business\Validator\Response\CrefoPayApiResponseValidatorInterface $validator |
|
40
|
|
|
* @param \SprykerEco\Zed\CrefoPayApi\Dependency\Service\CrefoPayApiToUtilEncodingServiceInterface $encodingService |
|
41
|
|
|
*/ |
|
42
|
|
|
public function __construct( |
|
43
|
|
|
CrefoPayApiResponseValidatorInterface $validator, |
|
44
|
|
|
CrefoPayApiToUtilEncodingServiceInterface $encodingService |
|
45
|
|
|
) { |
|
46
|
|
|
$this->validator = $validator; |
|
47
|
|
|
$this->encodingService = $encodingService; |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
/** |
|
51
|
|
|
* @param \Psr\Http\Message\ResponseInterface $response |
|
52
|
|
|
* |
|
53
|
|
|
* @return \Generated\Shared\Transfer\CrefoPayApiResponseTransfer |
|
54
|
|
|
*/ |
|
55
|
|
|
public function convertToResponseTransfer(ResponseInterface $response): CrefoPayApiResponseTransfer |
|
56
|
|
|
{ |
|
57
|
|
|
$responseData = $this->encodingService->decodeJson($response->getBody(), true); |
|
58
|
|
|
$responseTransfer = new CrefoPayApiResponseTransfer(); |
|
59
|
|
|
$responseTransfer = $this->updateResponseTransferWithApiCallResponse($responseTransfer, $responseData); |
|
|
|
|
|
|
60
|
|
|
$this->validator->validate($responseTransfer); |
|
61
|
|
|
|
|
62
|
|
|
return $responseTransfer; |
|
63
|
|
|
} |
|
64
|
|
|
} |
|
65
|
|
|
|
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:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths