Completed
Push — development ( ea08ae...a063ea )
by Volodymyr
15:59
created

AttributeOptionApiAdapter   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 86
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 18
dl 0
loc 86
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A listPerPage() 0 8 1
A all() 0 8 1
A get() 0 5 1
1
<?php
2
3
/**
4
 * MIT License
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\Attributes;
9
10
use Akeneo\Pim\ApiClient\AkeneoPimClientInterface;
11
use SprykerEco\Service\AkeneoPim\Dependencies\External\Api\Wrapper\WrapperFactoryInterface;
12
13
class AttributeOptionApiAdapter implements AttributeOptionApiAdapterInterface
14
{
15
    /**
16
     * @var \Akeneo\Pim\ApiClient\AkeneoPimClientInterface
17
     */
18
    protected $akeneoPimClient;
19
20
    /**
21
     * @var \SprykerEco\Service\AkeneoPim\Dependencies\External\Api\Wrapper\WrapperFactoryInterface
22
     */
23
    private $wrapperFactory;
24
25
    /**
26
     * @param \Akeneo\Pim\ApiClient\AkeneoPimClientInterface $akeneoPimClient
27
     * @param \SprykerEco\Service\AkeneoPim\Dependencies\External\Api\Wrapper\WrapperFactoryInterface $wrapperFactory
28
     */
29
    public function __construct(AkeneoPimClientInterface $akeneoPimClient, WrapperFactoryInterface $wrapperFactory)
30
    {
31
        $this->akeneoPimClient = $akeneoPimClient;
32
        $this->wrapperFactory = $wrapperFactory;
33
    }
34
35
    /**
36
<<<<<<< Updated upstream:src/SprykerEco/Service/AkeneoPim/Api/Adapter/Attributes/AttributeOptionApiAdapter.php
37
     * @inheritdoc
38
     *
39
     * @param string $code Code of the resource
40
     *
41
     * @return array
42
=======
43
     * {@inheritdoc}
44
>>>>>>> Stashed changes:src/SprykerEco/Service/AkeneoPim/Dependencies/External/Api/Adapter/Attributes/AttributeOptionApiAdapter.php
45
     */
46
    public function get($attributeCode, $code)
47
    {
48
        return $this->akeneoPimClient
49
            ->getAttributeOptionApi()
50
            ->get($attributeCode, $code);
51
    }
52
53
    /**
54
<<<<<<< Updated upstream:src/SprykerEco/Service/AkeneoPim/Api/Adapter/Attributes/AttributeOptionApiAdapter.php
55
     * @inheritdoc
56
     *
57
     * @param int $limit The maximum number of resources to return.
58
     *                               Do note that the server has a maximum limit allowed.
59
     * @param bool $withCount Set to true to return the total count of resources.
60
     *                               This parameter could decrease drastically the performance when set to true.
61
     * @param array $queryParameters Additional query parameters to pass in the request.
62
     *
63
     * @return \SprykerEco\Service\AkeneoPim\Api\Wrapper\AkeneoResourcePageInterface
0 ignored issues
show
Bug introduced by
The type SprykerEco\Service\Akene...eoResourcePageInterface was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
64
=======
65
     * {@inheritdoc}
66
>>>>>>> Stashed changes:src/SprykerEco/Service/AkeneoPim/Dependencies/External/Api/Adapter/Attributes/AttributeOptionApiAdapter.php
67
     */
68
    public function listPerPage($attributeCode, $limit = 10, $withCount = false, array $queryParameters = [])
69
    {
70
        $page = $this->akeneoPimClient
71
            ->getAttributeOptionApi()
72
            ->listPerPage($attributeCode, $limit, $withCount, $queryParameters);
73
74
        return $this->wrapperFactory
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->wrapperFac...createAkeneoPage($page) returns the type SprykerEco\Service\Akene...eoResourcePageInterface which is incompatible with the documented return type SprykerEco\Service\Akene...eoResourcePageInterface.
Loading history...
75
            ->createAkeneoPage($page);
76
    }
77
78
    /**
79
<<<<<<< Updated upstream:src/SprykerEco/Service/AkeneoPim/Api/Adapter/Attributes/AttributeOptionApiAdapter.php
80
     * @inheritdoc
81
     *
82
     * @param int $pageSize The size of the page returned by the server.
83
     *                               Do note that the server has a maximum limit allowed.
84
     * @param array $queryParameters Additional query parameters to pass in the request
85
     *
86
     * @return \SprykerEco\Service\AkeneoPim\Api\Wrapper\AkeneoResourceCursorInterface
0 ignored issues
show
Bug introduced by
The type SprykerEco\Service\Akene...ResourceCursorInterface was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
87
=======
88
     * {@inheritdoc}
89
>>>>>>> Stashed changes:src/SprykerEco/Service/AkeneoPim/Dependencies/External/Api/Adapter/Attributes/AttributeOptionApiAdapter.php
90
     */
91
    public function all($attributeCode, $pageSize = 10, array $queryParameters = [])
92
    {
93
        $resourceCursor = $this->akeneoPimClient
94
            ->getAttributeOptionApi()
95
            ->all($attributeCode, $pageSize, $queryParameters);
96
97
        return $this->wrapperFactory
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->wrapperFac...Cursor($resourceCursor) returns the type SprykerEco\Service\Akene...ResourceCursorInterface which is incompatible with the documented return type SprykerEco\Service\Akene...ResourceCursorInterface.
Loading history...
98
            ->createAkeneoResourceCursor($resourceCursor);
99
    }
100
}
101