Completed
Push — master ( e639bd...95f92c )
by
unknown
43s queued 10s
created

ShopUiDependencyProvider::addStore()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 7
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * Copyright © 2016-present Spryker Systems GmbH. All rights reserved.
5
 * Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
6
 */
7
8
namespace SprykerShop\Yves\ShopUi;
9
10
use Spryker\Shared\Kernel\Store;
11
use Spryker\Yves\Kernel\AbstractBundleDependencyProvider;
12
use Spryker\Yves\Kernel\Container;
13
use SprykerShop\Yves\ShopUi\Dependency\Client\ShopUiToTwigClientBridge;
14
15
class ShopUiDependencyProvider extends AbstractBundleDependencyProvider
16
{
17
    public const CLIENT_TWIG = 'CLIENT_TWIG';
18
19
    public const STORE = 'STORE';
20
21
    /**
22
     * @param \Spryker\Yves\Kernel\Container $container
23
     *
24
     * @return \Spryker\Yves\Kernel\Container
25
     */
26
    public function provideDependencies(Container $container): Container
27
    {
28
        $container = parent::provideDependencies($container);
29
        $container = $this->addTwigClient($container);
30
        $container = $this->addStore($container);
31
32
        return $container;
33
    }
34
35
    /**
36
     * @param \Spryker\Yves\Kernel\Container $container
37
     *
38
     * @return \Spryker\Yves\Kernel\Container
39
     */
40
    protected function addTwigClient(Container $container): Container
41
    {
42
        $container->set(static::CLIENT_TWIG, function (Container $container) {
43
            return new ShopUiToTwigClientBridge(
44
                $container->getLocator()->twig()->client()
45
            );
46
        });
47
48
        return $container;
49
    }
50
51
    /**
52
     * @param \Spryker\Yves\Kernel\Container $container
53
     *
54
     * @return \Spryker\Yves\Kernel\Container
55
     */
56
    protected function addStore(Container $container): Container
57
    {
58
        $container->set(static::STORE, function () {
59
            return Store::getInstance();
60
        });
61
62
        return $container;
63
    }
64
}
65