Passed
Pull Request — master (#11)
by Oleksandr
04:55
created

AssetVariationFileApiAdapter   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 67
Duplicated Lines 0 %

Importance

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

5 Methods

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