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

AssetReferenceFileApiAdapter   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 70
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 17
c 1
b 0
f 0
dl 0
loc 70
rs 10
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getFromLocalizableAsset() 0 5 1
A downloadFromLocalizableAsset() 0 5 1
A downloadFromNotLocalizableAsset() 0 5 1
A getFromNotLocalizableAsset() 0 5 1
A __construct() 0 4 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\Asset;
9
10
use Akeneo\PimEnterprise\ApiClient\AkeneoPimEnterpriseClientInterface;
11
use Psr\Http\Message\ResponseInterface;
12
use SprykerEco\Service\AkeneoPim\Dependencies\External\Api\Wrapper\WrapperFactoryInterface;
13
14
class AssetReferenceFileApiAdapter implements AssetReferenceFileApiAdapterInterface
15
{
16
    /**
17
     * @var \Akeneo\PimEnterprise\ApiClient\AkeneoPimEnterpriseClientInterface
18
     */
19
    protected $akeneoPimClient;
20
21
    /**
22
     * @var \SprykerEco\Service\AkeneoPim\Dependencies\External\Api\Wrapper\WrapperFactoryInterface
23
     */
24
    protected $wrapperFactory;
25
26
    /**
27
     * @param \Akeneo\PimEnterprise\ApiClient\AkeneoPimEnterpriseClientInterface $akeneoPimClient
28
     * @param \SprykerEco\Service\AkeneoPim\Dependencies\External\Api\Wrapper\WrapperFactoryInterface $wrapperFactory
29
     */
30
    public function __construct(AkeneoPimEnterpriseClientInterface $akeneoPimClient, WrapperFactoryInterface $wrapperFactory)
31
    {
32
        $this->akeneoPimClient = $akeneoPimClient;
33
        $this->wrapperFactory = $wrapperFactory;
34
    }
35
36
    /**
37
     * @param string $assetCode
38
     * @param string $localeCode
39
     *
40
     * @return array
41
     */
42
    public function getFromLocalizableAsset(string $assetCode, string $localeCode): array
43
    {
44
        return $this->akeneoPimClient
45
            ->getAssetReferenceFileApi()
46
            ->getFromLocalizableAsset($assetCode, $localeCode);
47
    }
48
49
    /**
50
     * @param string $assetCode
51
     *
52
     * @return array
53
     */
54
    public function getFromNotLocalizableAsset(string $assetCode): array
55
    {
56
        return $this->akeneoPimClient
57
            ->getAssetReferenceFileApi()
58
            ->getFromNotLocalizableAsset($assetCode);
59
    }
60
61
    /**
62
     * @param string $assetCode
63
     * @param string $localeCode
64
     *
65
     * @return \Psr\Http\Message\ResponseInterface
66
     */
67
    public function downloadFromLocalizableAsset(string $assetCode, string $localeCode): ResponseInterface
68
    {
69
        return $this->akeneoPimClient
70
            ->getAssetReferenceFileApi()
71
            ->downloadFromLocalizableAsset($assetCode, $localeCode);
72
    }
73
74
    /**
75
     * @param string $assetCode
76
     *
77
     * @return \Psr\Http\Message\ResponseInterface
78
     */
79
    public function downloadFromNotLocalizableAsset(string $assetCode): ResponseInterface
80
    {
81
        return $this->akeneoPimClient
82
            ->getAssetReferenceFileApi()
83
            ->downloadFromNotLocalizableAsset($assetCode);
84
    }
85
}
86