ProductSetWidgetDependencyProvider   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 13
dl 0
loc 53
c 0
b 0
f 0
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A provideDependencies() 0 8 1
A addProductStorageClient() 0 7 1
A addProductSetStorageClient() 0 7 1
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
declare(strict_types = 1);
9
10
namespace Pyz\Yves\ProductSetWidget;
11
12
use Spryker\Yves\Kernel\Container;
13
use SprykerShop\Yves\ProductSetWidget\ProductSetWidgetDependencyProvider as SprykerProductSetWidgetDependencyProvider;
14
15
class ProductSetWidgetDependencyProvider extends SprykerProductSetWidgetDependencyProvider
16
{
17
    /**
18
     * @var string
19
     */
20
    public const CLIENT_PRODUCT_SET_STORAGE = 'CLIENT_PRODUCT_SET_STORAGE';
21
22
    /**
23
     * @var string
24
     */
25
    public const CLIENT_PRODUCT_STORAGE = 'CLIENT_PRODUCT_STORAGE';
26
27
    /**
28
     * @param \Spryker\Yves\Kernel\Container $container
29
     *
30
     * @return \Spryker\Yves\Kernel\Container
31
     */
32
    public function provideDependencies(Container $container): Container
33
    {
34
        $container = parent::provideDependencies($container);
35
36
        $container = $this->addProductStorageClient($container);
37
        $container = $this->addProductSetStorageClient($container);
38
39
        return $container;
40
    }
41
42
    /**
43
     * @param \Spryker\Yves\Kernel\Container $container
44
     *
45
     * @return mixed
46
     */
47
    protected function addProductStorageClient(Container $container)
48
    {
49
        $container->set(static::CLIENT_PRODUCT_STORAGE, function (Container $container) {
50
            return $container->getLocator()->productStorage()->client();
51
        });
52
53
        return $container;
54
    }
55
56
    /**
57
     * @param \Spryker\Yves\Kernel\Container $container
58
     *
59
     * @return \Spryker\Yves\Kernel\Container
60
     */
61
    protected function addProductSetStorageClient(Container $container): Container
62
    {
63
        $container->set(static::CLIENT_PRODUCT_SET_STORAGE, function (Container $container) {
64
            return $container->getLocator()->productSetStorage()->client();
65
        });
66
67
        return $container;
68
    }
69
}
70