Passed
Pull Request — master (#74)
by mark
13:30
created

PayoneDependencyProvider::addZedService()   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
13
class PayoneDependencyProvider extends AbstractDependencyProvider
14
{
15
    /**
16
     * @var string
17
     */
18
    public const SERVICE_ZED = 'service zed';
19
20
    /**
21
     * @var string
22
     */
23
    public const SERVICE_UTIL_ENCODING = 'SERVICE_UTIL_ENCODING';
24
25
    /**
26
     * @param \Spryker\Client\Kernel\Container $container
27
     *
28
     * @return \Spryker\Client\Kernel\Container
29
     */
30
    public function provideServiceLayerDependencies(Container $container): Container
31
    {
32
        $this->addZedService($container);
33
        $this->addUtilEncodingService($container);
34
35
        return $container;
36
    }
37
38
    /**
39
     * @param \Spryker\Client\Kernel\Container $container
40
     *
41
     * @return \Spryker\Client\Kernel\Container
42
     */
43
    protected function addZedService(Container $container): Container
44
    {
45
        $container->set(static::SERVICE_ZED, function (Container $container) {
46
            return $container->getLocator()->zedRequest()->client();
47
        });
48
49
        return $container;
50
    }
51
52
    /**
53
     * @param \Spryker\Client\Kernel\Container $container
54
     *
55
     * @return \Spryker\Client\Kernel\Container
56
     */
57
    protected function addUtilEncodingService(Container $container): Container
58
    {
59
        $container->set(static::SERVICE_UTIL_ENCODING, function (Container $container) {
60
            return $container->getLocator()->utilEncoding()->service();
61
        });
62
63
        return $container;
64
    }
65
}
66