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\Service\AkeneoPim\Dependencies\External\Api\Adapter\Sdk; |
9
|
|
|
|
10
|
|
|
use Akeneo\Pim\ApiClient\AkeneoPimClientBuilder; |
|
|
|
|
11
|
|
|
use Akeneo\Pim\ApiClient\AkeneoPimClientInterface; |
|
|
|
|
12
|
|
|
use Akeneo\Pim\ApiClient\Client\ClientInterface as AkeneoClientInterface; |
|
|
|
|
13
|
|
|
use Psr\Http\Client\ClientInterface; |
|
|
|
|
14
|
|
|
use SprykerEco\Service\AkeneoPim\AkeneoPimConfig; |
15
|
|
|
use SprykerEco\Service\AkeneoPim\Dependencies\External\Api\Adapter\HttpClient\AkeneoHttpClient; |
16
|
|
|
use SprykerEco\Service\AkeneoPim\Dependencies\External\Api\Adapter\HttpClient\Client; |
17
|
|
|
|
18
|
|
|
class AkeneoPimSdkFactory implements AkeneoPimSdkFactoryInterface |
19
|
|
|
{ |
20
|
|
|
/** |
21
|
|
|
* @param \SprykerEco\Service\AkeneoPim\AkeneoPimConfig $config |
22
|
|
|
* |
23
|
|
|
* @return \Akeneo\Pim\ApiClient\AkeneoPimClientInterface |
24
|
|
|
*/ |
25
|
|
|
public function createAkeneoPimClient(AkeneoPimConfig $config): AkeneoPimClientInterface |
26
|
|
|
{ |
27
|
|
|
$clientBuilder = new AkeneoPimClientBuilder($config->getHost()); |
28
|
|
|
$clientBuilder->setHttpClient($this->getHttpClient()); |
29
|
|
|
|
30
|
|
|
return $clientBuilder->buildAuthenticatedByPassword( |
31
|
|
|
$config->getClientId(), |
32
|
|
|
$config->getClientSecret(), |
33
|
|
|
$config->getUsername(), |
34
|
|
|
$config->getPassword(), |
35
|
|
|
); |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @return \Psr\Http\Client\ClientInterface |
40
|
|
|
*/ |
41
|
|
|
public function createHttpClient(): ClientInterface |
42
|
|
|
{ |
43
|
|
|
return new Client(); |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* @return \Akeneo\Pim\ApiClient\Client\ClientInterface |
48
|
|
|
*/ |
49
|
|
|
public function createAkeneoHttpClient(): AkeneoClientInterface |
50
|
|
|
{ |
51
|
|
|
return new AkeneoHttpClient(); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* @return \Akeneo\Pim\ApiClient\Client\ClientInterface|\Psr\Http\Client\ClientInterface |
56
|
|
|
*/ |
57
|
|
|
public function getHttpClient() |
58
|
|
|
{ |
59
|
|
|
if (interface_exists('\Akeneo\Pim\ApiClient\Client\ClientInterface')) { |
60
|
|
|
return $this->createAkeneoHttpClient(); |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
return $this->createHttpClient(); |
64
|
|
|
} |
65
|
|
|
} |
66
|
|
|
|
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