Passed
Pull Request — master (#495)
by Aleksey
09:33
created

getMiniCartViewExpanderPlugins()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
/**
4
 * This file is part of the Spryker Commerce OS.
5
 * For full license information, please view the LICENSE file that was distributed with this source code.
6
 */
7
8
namespace Pyz\Yves\CartPage;
9
10
use Pyz\Yves\CartPage\Plugin\Cart\CartBlockMiniCartViewExpanderPlugin;
11
use Spryker\Yves\Kernel\Container;
12
use SprykerShop\Yves\CartPage\CartPageDependencyProvider as SprykerCartPageDependencyProvider;
13
use SprykerShop\Yves\DiscountPromotionWidget\Plugin\CartPage\DiscountPromotionAddToCartFormWidgetParameterExpanderPlugin;
14
use SprykerShop\Yves\ProductBundleWidget\Plugin\CartPage\ProductBundleCartItemTransformerPlugin;
15
use SprykerShop\Yves\UrlPage\Plugin\CartPage\UrlCartItemTransformerPlugin;
16
17
class CartPageDependencyProvider extends SprykerCartPageDependencyProvider
18
{
19
    /**
20
     * @var string
21
     */
22
    public const TWIG_ENVIRONMENT = 'TWIG_ENVIRONMENT';
23
24
    /**
25
     * @uses \Spryker\Yves\Twig\Plugin\Application\TwigApplicationPlugin::SERVICE_TWIG
26
     *
27
     * @var string
28
     */
29
    protected const SERVICE_TWIG = 'twig';
30
31
    /**
32
     * @param \Spryker\Yves\Kernel\Container $container
33
     *
34
     * @return \Spryker\Yves\Kernel\Container
35
     */
36
    public function provideDependencies(Container $container): Container
37
    {
38
        $container = parent::provideDependencies($container);
39
40
        $container = $this->addTwigService($container);
41
42
        return $container;
43
    }
44
45
    /**
46
     * @param \Spryker\Yves\Kernel\Container $container
47
     *
48
     * @return \Spryker\Yves\Kernel\Container
49
     */
50
    protected function addTwigService(Container $container): Container
51
    {
52
        $container->set(static::TWIG_ENVIRONMENT, function (Container $container) {
53
            return $container->getApplicationService(static::SERVICE_TWIG);
54
        });
55
56
        return $container;
57
    }
58
59
    /**
60
     * @return array<\SprykerShop\Yves\CartPageExtension\Dependency\Plugin\CartItemTransformerPluginInterface>
61
     */
62
    protected function getCartItemTransformerPlugins(): array
63
    {
64
        return [
65
            new ProductBundleCartItemTransformerPlugin(),
66
            new UrlCartItemTransformerPlugin(),
67
        ];
68
    }
69
70
    /**
71
     * @return array<\SprykerShop\Yves\CartPageExtension\Dependency\Plugin\AddToCartFormWidgetParameterExpanderPluginInterface>
72
     */
73
    protected function getAddToCartFormWidgetParameterExpanderPlugins(): array
74
    {
75
        return [
76
            new DiscountPromotionAddToCartFormWidgetParameterExpanderPlugin(),
77
        ];
78
    }
79
80
    /**
81
     * @return array<\SprykerShop\Yves\CartPageExtension\Dependency\Plugin\MiniCartViewExpanderPluginInterface>
82
     */
83
    protected function getMiniCartViewExpanderPlugins(): array
84
    {
85
        return [
86
            new CartBlockMiniCartViewExpanderPlugin(),
87
        ];
88
    }
89
}
90