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

AttributeGroupApiAdapter   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 get() 0 5 1
A all() 0 8 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\Adapter\ApiAdapterInterface;
12
use SprykerEco\Service\AkeneoPim\Dependencies\External\Api\Wrapper\WrapperFactoryInterface;
13
14
class AttributeGroupApiAdapter implements ApiAdapterInterface
15
{
16
    /**
17
     * @var \Akeneo\Pim\ApiClient\AkeneoPimClientInterface
18
     */
19
    protected $akeneoPimClient;
20
21
    /**
22
     * @var \SprykerEco\Service\AkeneoPim\Dependencies\External\Api\Wrapper\WrapperFactoryInterface
23
     */
24
    private $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(AkeneoPimClientInterface $akeneoPimClient, WrapperFactoryInterface $wrapperFactory)
31
    {
32
        $this->akeneoPimClient = $akeneoPimClient;
33
        $this->wrapperFactory = $wrapperFactory;
34
    }
35
36
    /**
37
<<<<<<< Updated upstream:src/SprykerEco/Service/AkeneoPim/Api/Adapter/Attributes/AttributeGroupApiAdapter.php
38
     * @inheritdoc
39
     *
40
     * @param string $code Code of the resource
41
     *
42
     * @return array
43
=======
44
     * {@inheritdoc}
45
>>>>>>> Stashed changes:src/SprykerEco/Service/AkeneoPim/Dependencies/External/Api/Adapter/Attributes/AttributeGroupApiAdapter.php
46
     */
47
    public function get($code)
48
    {
49
        return $this->akeneoPimClient
50
            ->getAttributeGroupApi()
51
            ->get($code);
52
    }
53
54
    /**
55
<<<<<<< Updated upstream:src/SprykerEco/Service/AkeneoPim/Api/Adapter/Attributes/AttributeGroupApiAdapter.php
56
     * @inheritdoc
57
     *
58
     * @param int $limit The maximum number of resources to return.
59
     *                               Do note that the server has a maximum limit allowed.
60
     * @param bool $withCount Set to true to return the total count of resources.
61
     *                               This parameter could decrease drastically the performance when set to true.
62
     * @param array $queryParameters Additional query parameters to pass in the request.
63
     *
64
     * @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...
65
=======
66
     * {@inheritdoc}
67
>>>>>>> Stashed changes:src/SprykerEco/Service/AkeneoPim/Dependencies/External/Api/Adapter/Attributes/AttributeGroupApiAdapter.php
68
     */
69
    public function listPerPage($limit = 10, $withCount = false, array $queryParameters = [])
70
    {
71
        $page = $this->akeneoPimClient
72
            ->getAttributeGroupApi()
73
            ->listPerPage($limit, $withCount, $queryParameters);
74
75
        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...
76
            ->createAkeneoPage($page);
77
    }
78
79
    /**
80
<<<<<<< Updated upstream:src/SprykerEco/Service/AkeneoPim/Api/Adapter/Attributes/AttributeGroupApiAdapter.php
81
     * @inheritdoc
82
     *
83
     * @param int $pageSize The size of the page returned by the server.
84
     *                               Do note that the server has a maximum limit allowed.
85
     * @param array $queryParameters Additional query parameters to pass in the request
86
     *
87
     * @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...
88
=======
89
     * {@inheritdoc}
90
>>>>>>> Stashed changes:src/SprykerEco/Service/AkeneoPim/Dependencies/External/Api/Adapter/Attributes/AttributeGroupApiAdapter.php
91
     */
92
    public function all($pageSize = 10, array $queryParameters = [])
93
    {
94
        $resourceCursor = $this->akeneoPimClient
95
            ->getAttributeGroupApi()
96
            ->all($pageSize, $queryParameters);
97
98
        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...
99
            ->createAkeneoResourceCursor($resourceCursor);
100
    }
101
}
102