Completed
Push — master ( ffc46f...f233a4 )
by
unknown
20s queued 13s
created

OrderCustomReferenceWidgetDependencyProvider   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 15
c 1
b 0
f 0
dl 0
loc 49
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A addOrderCustomReferenceClient() 0 9 1
A provideDependencies() 0 7 1
A addQuoteClient() 0 9 1
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\OrderCustomReferenceWidget;
9
10
use Spryker\Yves\Kernel\AbstractBundleDependencyProvider;
11
use Spryker\Yves\Kernel\Container;
12
use SprykerShop\Yves\OrderCustomReferenceWidget\Dependency\Client\OrderCustomReferenceWidgetToOrderCustomReferenceClientBridge;
13
use SprykerShop\Yves\OrderCustomReferenceWidget\Dependency\Client\OrderCustomReferenceWidgetToQuoteClientBridge;
14
15
class OrderCustomReferenceWidgetDependencyProvider extends AbstractBundleDependencyProvider
16
{
17
    public const CLIENT_ORDER_CUSTOM_REFERENCE = 'CLIENT_ORDER_CUSTOM_REFERENCE';
18
    public const CLIENT_QUOTE = 'CLIENT_QUOTE';
19
20
    /**
21
     * @param \Spryker\Yves\Kernel\Container $container
22
     *
23
     * @return \Spryker\Yves\Kernel\Container
24
     */
25
    public function provideDependencies(Container $container): Container
26
    {
27
        $container = parent::provideDependencies($container);
28
        $container = $this->addOrderCustomReferenceClient($container);
29
        $container = $this->addQuoteClient($container);
30
31
        return $container;
32
    }
33
34
    /**
35
     * @param \Spryker\Yves\Kernel\Container $container
36
     *
37
     * @return \Spryker\Yves\Kernel\Container
38
     */
39
    protected function addOrderCustomReferenceClient(Container $container): Container
40
    {
41
        $container->set(static::CLIENT_ORDER_CUSTOM_REFERENCE, function (Container $container) {
42
            return new OrderCustomReferenceWidgetToOrderCustomReferenceClientBridge(
43
                $container->getLocator()->orderCustomReference()->client()
44
            );
45
        });
46
47
        return $container;
48
    }
49
50
    /**
51
     * @param \Spryker\Yves\Kernel\Container $container
52
     *
53
     * @return \Spryker\Yves\Kernel\Container
54
     */
55
    protected function addQuoteClient(Container $container): Container
56
    {
57
        $container->set(static::CLIENT_QUOTE, function (Container $container) {
58
            return new OrderCustomReferenceWidgetToQuoteClientBridge(
59
                $container->getLocator()->quote()->client()
60
            );
61
        });
62
63
        return $container;
64
    }
65
}
66