EasycreditDependencyProvider   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 61
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 17
c 1
b 0
f 0
dl 0
loc 61
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A addPluginMoney() 0 7 1
A addClientCalculation() 0 7 1
A addClientQuote() 0 7 1
A provideDependencies() 0 7 1
1
<?php
2
3
/**
4
 * MIT License
5
 * For full license information, please view the LICENSE file that was distributed with this source code.
6
 */
7
8
namespace SprykerEco\Yves\Easycredit;
9
10
use Spryker\Yves\Kernel\AbstractBundleDependencyProvider;
11
use Spryker\Yves\Kernel\Container;
12
use Spryker\Yves\Money\Plugin\MoneyPlugin;
13
use SprykerEco\Yves\Easycredit\Dependency\Client\EasycreditToCalculationClientBridge;
14
use SprykerEco\Yves\Easycredit\Dependency\Client\EasycreditToQuoteClientBridge;
15
16
class EasycreditDependencyProvider extends AbstractBundleDependencyProvider
17
{
18
    public const CLIENT_CALCULATION = 'CLIENT_CALCULATION';
19
    public const CLIENT_QUOTE = 'CLIENT_QUOTE';
20
21
    public const PLUGIN_MONEY = 'PLUGIN_MONEY';
22
23
    /**
24
     * @param \Spryker\Yves\Kernel\Container $container
25
     *
26
     * @return \Spryker\Yves\Kernel\Container
27
     */
28
    public function provideDependencies(Container $container): Container
29
    {
30
        $container = $this->addClientCalculation($container);
31
        $container = $this->addClientQuote($container);
32
        $container = $this->addPluginMoney($container);
33
34
        return $container;
35
    }
36
37
    /**
38
     * @param \Spryker\Yves\Kernel\Container $container
39
     *
40
     * @return \Spryker\Yves\Kernel\Container
41
     */
42
    protected function addClientCalculation(Container $container): Container
43
    {
44
        $container[static::CLIENT_CALCULATION] = function (Container $container) {
45
            return new EasycreditToCalculationClientBridge($container->getLocator()->calculation()->client());
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 addClientQuote(Container $container): Container
57
    {
58
        $container[static::CLIENT_QUOTE] = function (Container $container) {
59
            return new EasycreditToQuoteClientBridge($container->getLocator()->quote()->client());
60
        };
61
62
        return $container;
63
    }
64
65
    /**
66
     * @param \Spryker\Yves\Kernel\Container $container
67
     *
68
     * @return \Spryker\Yves\Kernel\Container
69
     */
70
    protected function addPluginMoney(Container $container): Container
71
    {
72
        $container[static::PLUGIN_MONEY] = function () {
73
            return new MoneyPlugin();
74
        };
75
76
        return $container;
77
    }
78
}
79