|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* Copyright © 2016-present Spryker Systems GmbH. All rights reserved. |
|
5
|
|
|
* Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file. |
|
6
|
|
|
*/ |
|
7
|
|
|
|
|
8
|
|
|
namespace SprykerEco\Client\Coremedia\Api\Executor; |
|
9
|
|
|
|
|
10
|
|
|
use Generated\Shared\Transfer\CoremediaApiResponseTransfer; |
|
|
|
|
|
|
11
|
|
|
use Psr\Http\Message\RequestInterface; |
|
12
|
|
|
use RuntimeException; |
|
13
|
|
|
use Spryker\Shared\ErrorHandler\ErrorLogger; |
|
14
|
|
|
use SprykerEco\Client\Coremedia\CoremediaConfig; |
|
15
|
|
|
use SprykerEco\Client\Coremedia\Dependency\Guzzle\CoremediaToGuzzleInterface; |
|
16
|
|
|
|
|
17
|
|
|
class RequestExecutor implements RequestExecutorInterface |
|
18
|
|
|
{ |
|
19
|
|
|
/** |
|
20
|
|
|
* @var \SprykerEco\Client\Coremedia\Dependency\Guzzle\CoremediaToGuzzleInterface |
|
21
|
|
|
*/ |
|
22
|
|
|
protected $httpClient; |
|
23
|
|
|
|
|
24
|
|
|
/** |
|
25
|
|
|
* @var \SprykerEco\Client\Coremedia\CoremediaConfig |
|
26
|
|
|
*/ |
|
27
|
|
|
protected $config; |
|
28
|
|
|
|
|
29
|
|
|
/** |
|
30
|
|
|
* @param \SprykerEco\Client\Coremedia\Dependency\Guzzle\CoremediaToGuzzleInterface $httpClient |
|
31
|
|
|
* @param \SprykerEco\Client\Coremedia\CoremediaConfig $config |
|
32
|
|
|
*/ |
|
33
|
|
|
public function __construct(CoremediaToGuzzleInterface $httpClient, CoremediaConfig $config) |
|
34
|
|
|
{ |
|
35
|
|
|
$this->httpClient = $httpClient; |
|
36
|
|
|
$this->config = $config; |
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* @param \Psr\Http\Message\RequestInterface $request |
|
41
|
|
|
* |
|
42
|
|
|
* @return \Generated\Shared\Transfer\CoremediaApiResponseTransfer |
|
43
|
|
|
*/ |
|
44
|
|
|
public function execute(RequestInterface $request): CoremediaApiResponseTransfer |
|
45
|
|
|
{ |
|
46
|
|
|
try { |
|
47
|
|
|
$response = $this->httpClient->send($request); |
|
48
|
|
|
} catch (RuntimeException $runtimeException) { |
|
49
|
|
|
if ($this->config->isDebugModeEnabled()) { |
|
50
|
|
|
ErrorLogger::getInstance()->log($runtimeException); |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
return (new CoremediaApiResponseTransfer()) |
|
54
|
|
|
->setIsSuccessful(false); |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
return (new CoremediaApiResponseTransfer()) |
|
58
|
|
|
->setIsSuccessful(true) |
|
59
|
|
|
->setData($response->getBody()->getContents()); |
|
60
|
|
|
} |
|
61
|
|
|
} |
|
62
|
|
|
|
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