Passed
Pull Request — master (#74)
by oleksandr
04:34
created

PayoneDependencyProvider::addZedRequestClient()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
c 0
b 0
f 0
dl 0
loc 7
rs 10
cc 1
nc 1
nop 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\Client\Payone;
9
10
use Spryker\Client\Kernel\AbstractDependencyProvider;
11
use Spryker\Client\Kernel\Container;
12
use SprykerEco\Client\Payone\Dependency\Client\PayoneToUtilEncodingServiceBridge;
13
14
class PayoneDependencyProvider extends AbstractDependencyProvider
15
{
16
    /**
17
     * @var string
18
     */
19
    public const CLIENT_ZED_REQUEST = 'CLIENT_ZED_REQUEST';
20
21
    /**
22
     * @var string
23
     */
24
    public const SERVICE_UTIL_ENCODING = 'SERVICE_UTIL_ENCODING';
25
26
    /**
27
     * @param \Spryker\Client\Kernel\Container $container
28
     *
29
     * @return \Spryker\Client\Kernel\Container
30
     */
31
    public function provideServiceLayerDependencies(Container $container): Container
32
    {
33
        $container = parent::provideServiceLayerDependencies($container);
34
35
        $this->addZedRequestClient($container);
36
        $this->addUtilEncodingService($container);
37
38
        return $container;
39
    }
40
41
    /**
42
     * @param \Spryker\Client\Kernel\Container $container
43
     *
44
     * @return \Spryker\Client\Kernel\Container
45
     */
46
    protected function addZedRequestClient(Container $container): Container
47
    {
48
        $container->set(static::CLIENT_ZED_REQUEST, function (Container $container) {
49
            return $container->getLocator()->zedRequest()->client();
50
        });
51
52
        return $container;
53
    }
54
55
    /**
56
     * @param \Spryker\Client\Kernel\Container $container
57
     *
58
     * @return \Spryker\Client\Kernel\Container
59
     */
60
    protected function addUtilEncodingService(Container $container): Container
61
    {
62
        $container->set(static::SERVICE_UTIL_ENCODING, function (Container $container) {
63
            return new PayoneToUtilEncodingServiceBridge($container->getLocator()->utilEncoding()->service());
64
        });
65
66
        return $container;
67
    }
68
}
69