Passed
Pull Request — master (#11)
by Oleksandr
04:55
created

ReferenceEntityApiAdapter   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A get() 0 5 1
A all() 0 5 1
A __construct() 0 3 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
13
class ReferenceEntityApiAdapter implements ReferenceEntityApiAdapterInterface
14
{
15
    /**
16
     * @var \Akeneo\PimEnterprise\ApiClient\AkeneoPimEnterpriseClientInterface
17
     */
18
    protected $akeneoPimClient;
19
20
    /**
21
     * @param \Akeneo\Pim\ApiClient\AkeneoPimClientInterface $akeneoPimClient
22
     */
23
    public function __construct(AkeneoPimEnterpriseClientInterface $akeneoPimClient)
24
    {
25
        $this->akeneoPimClient = $akeneoPimClient;
26
    }
27
28
    /**
29
     * @param string $referenceEntityCode
30
     *
31
     * @return array
32
     */
33
    public function get(string $referenceEntityCode): array
34
    {
35
        return $this->akeneoPimClient
36
            ->getReferenceEntityApi()
37
            ->get($referenceEntityCode);
38
    }
39
40
    /**
41
     * @param array $queryParameters
42
     *
43
     * @return \Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface
44
     */
45
    public function all(array $queryParameters = []): ResourceCursorInterface
46
    {
47
        return $this->akeneoPimClient
48
            ->getReferenceEntityApi()
49
            ->all($queryParameters);
50
    }
51
}
52