Passed
Pull Request — master (#11)
by Volodymyr
09:33 queued 04:51
created

ReferenceEntityAttributeApiAdapter   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 11
dl 0
loc 46
rs 10
c 1
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A all() 0 5 1
A get() 0 5 1
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\Service\AkeneoPim\Dependencies\External\Api\Adapter\ReferenceEntity;
9
10
use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface;
11
use Akeneo\PimEnterprise\ApiClient\AkeneoPimEnterpriseClientInterface;
12
use SprykerEco\Service\AkeneoPim\Dependencies\External\Api\Wrapper\WrapperFactoryInterface;
13
14
class ReferenceEntityAttributeApiAdapter implements ReferenceEntityAttributeApiAdapterInterface
15
{
16
    /**
17
     * @var \Akeneo\PimEnterprise\ApiClient\AkeneoPimEnterpriseClientInterface
18
     */
19
    protected $akeneoPimClient;
20
21
    /**
22
     * @var \SprykerEco\Service\AkeneoPim\Dependencies\External\Api\Wrapper\WrapperFactoryInterface
23
     */
24
    protected $wrapperFactory;
25
26
    /**
27
     * @param \Akeneo\Pim\ApiClient\AkeneoPimClientInterface $akeneoPimClient
28
     * @param \SprykerEco\Service\AkeneoPim\Dependencies\External\Api\Wrapper\WrapperFactoryInterface $wrapperFactory
29
     */
30
    public function __construct(AkeneoPimEnterpriseClientInterface $akeneoPimClient, WrapperFactoryInterface $wrapperFactory)
31
    {
32
        $this->akeneoPimClient = $akeneoPimClient;
33
        $this->wrapperFactory = $wrapperFactory;
34
    }
35
36
    /**
37
     * @param string $referenceEntityCode
38
     * @param string $attributeCode
39
     *
40
     * @return array
41
     */
42
    public function get(string $referenceEntityCode, string $attributeCode): array
43
    {
44
        return $this->akeneoPimClient
45
            ->getReferenceEntityAttributeApi()
46
            ->get($referenceEntityCode, $attributeCode);
47
    }
48
49
    /**
50
     * @param string $referenceEntityCode
51
     * @param array $queryParameters
52
     *
53
     * @return \Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface
54
     */
55
    public function all(string $referenceEntityCode, array $queryParameters = []): ResourceCursorInterface
56
    {
57
        return $this->akeneoPimClient
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->akeneoPimC...Code, $queryParameters) returns the type array which is incompatible with the type-hinted return Akeneo\Pim\ApiClient\Pag...ResourceCursorInterface.
Loading history...
58
            ->getReferenceEntityAttributeApi()
59
            ->all($referenceEntityCode, $queryParameters);
60
    }
61
}
62