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

ReferenceEntityAttributeOptionApiAdapter   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 11
c 1
b 0
f 0
dl 0
loc 47
rs 10
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\PimEnterprise\ApiClient\AkeneoPimEnterpriseClientInterface;
11
use SprykerEco\Service\AkeneoPim\Dependencies\External\Api\Wrapper\WrapperFactoryInterface;
12
13
class ReferenceEntityAttributeOptionApiAdapter implements ReferenceEntityAttributeOptionApiAdapterInterface
14
{
15
    /**
16
     * @var \Akeneo\PimEnterprise\ApiClient\AkeneoPimEnterpriseClientInterface
17
     */
18
    protected $akeneoPimClient;
19
20
    /**
21
     * @var \SprykerEco\Service\AkeneoPim\Dependencies\External\Api\Wrapper\WrapperFactoryInterface
22
     */
23
    protected $wrapperFactory;
24
25
    /**
26
     * @param \Akeneo\PimEnterprise\ApiClient\AkeneoPimEnterpriseClientInterface $akeneoPimClient
27
     * @param \SprykerEco\Service\AkeneoPim\Dependencies\External\Api\Wrapper\WrapperFactoryInterface $wrapperFactory
28
     */
29
    public function __construct(AkeneoPimEnterpriseClientInterface $akeneoPimClient, WrapperFactoryInterface $wrapperFactory)
30
    {
31
        $this->akeneoPimClient = $akeneoPimClient;
32
        $this->wrapperFactory = $wrapperFactory;
33
    }
34
35
    /**
36
     * @param string $referenceEntityCode Code of the reference entity
37
     * @param string $attributeCode Code of the attribute
38
     * @param string $attributeOptionCode Code of the attribute option
39
     *
40
     * @return array
41
     */
42
    public function get(string $referenceEntityCode, string $attributeCode, string $attributeOptionCode): array
43
    {
44
        return $this->akeneoPimClient
45
            ->getReferenceEntityAttributeOptionApi()
46
            ->get($referenceEntityCode, $attributeCode, $attributeOptionCode);
47
    }
48
49
    /**
50
     * @param string $referenceEntityCode Code of the reference entity
51
     * @param string $attributeCode Code of the attribute
52
     *
53
     * @return array
54
     */
55
    public function all(string $referenceEntityCode, string $attributeCode): array
56
    {
57
        return $this->akeneoPimClient
58
            ->getReferenceEntityAttributeOptionApi()
59
            ->all($referenceEntityCode, $attributeCode);
60
    }
61
}
62