Completed
Pull Request — master (#11)
by Volodymyr
08:11 queued 03:25
created

ReferenceEntityAttributeOptionApiAdapter   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 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
12
class ReferenceEntityAttributeOptionApiAdapter implements ReferenceEntityAttributeOptionApiAdapterInterface
13
{
14
    /**
15
     * @var \Akeneo\PimEnterprise\ApiClient\AkeneoPimEnterpriseClientInterface
16
     */
17
    protected $akeneoPimClient;
18
19
    /**
20
     * @param \Akeneo\PimEnterprise\ApiClient\AkeneoPimEnterpriseClientInterface $akeneoPimClient
21
     */
22
    public function __construct(AkeneoPimEnterpriseClientInterface $akeneoPimClient)
23
    {
24
        $this->akeneoPimClient = $akeneoPimClient;
25
    }
26
27
    /**
28
     * @param string $referenceEntityCode Code of the reference entity
29
     * @param string $attributeCode Code of the attribute
30
     * @param string $attributeOptionCode Code of the attribute option
31
     *
32
     * @return array
33
     */
34
    public function get(string $referenceEntityCode, string $attributeCode, string $attributeOptionCode): array
35
    {
36
        return $this->akeneoPimClient
37
            ->getReferenceEntityAttributeOptionApi()
38
            ->get($referenceEntityCode, $attributeCode, $attributeOptionCode);
39
    }
40
41
    /**
42
     * @param string $referenceEntityCode Code of the reference entity
43
     * @param string $attributeCode Code of the attribute
44
     *
45
     * @return array
46
     */
47
    public function all(string $referenceEntityCode, string $attributeCode): array
48
    {
49
        return $this->akeneoPimClient
50
            ->getReferenceEntityAttributeOptionApi()
51
            ->all($referenceEntityCode, $attributeCode);
52
    }
53
}
54