Passed
Push — feature/eco-574/eco-2266-check... ( efd21d )
by Aleksey
08:13
created

AfterpayDependencyProvider   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Importance

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

3 Methods

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