Passed
Pull Request — master (#9)
by Volodymyr
04:30
created

BraintreeDependencyProvider::addQuoteClient()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 7
rs 10
c 0
b 0
f 0
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\Braintree;
9
10
use Spryker\Yves\Currency\Plugin\CurrencyPlugin;
11
use Spryker\Yves\Kernel\AbstractBundleDependencyProvider;
12
use Spryker\Yves\Kernel\Container;
13
use SprykerEco\Yves\Braintree\Dependency\Client\BraintreeToQuoteClientBridge;
14
use SprykerEco\Yves\Braintree\Dependency\Client\BraintreeToShipmentClientBridge;
15
use SprykerEco\Yves\Braintree\Dependency\Service\BraintreeToUtilEncodingServiceBridge;
16
17
class BraintreeDependencyProvider extends AbstractBundleDependencyProvider
18
{
19
    public const PLUGIN_CURRENCY = 'PLUGIN_CURRENCY';
20
21
    public const CLIENT_QUOTE = 'CLIENT_QUOTE';
22
    public const CLIENT_SHIPMENT = 'CLIENT_SHIPMENT';
23
24
    public const SERVICE_UTIL_ENCODING = 'UTIL_ENCODING_SERVICE';
25
26
    /**
27
     * @param \Spryker\Yves\Kernel\Container $container
28
     *
29
     * @return \Spryker\Yves\Kernel\Container|\Spryker\Zed\Kernel\Container
30
     */
31
    public function provideDependencies(Container $container)
32
    {
33
        $container = $this->addCurrencyPlugin($container);
34
        $container = $this->addQuoteClient($container);
35
        $container = $this->addUtilEncodingService($container);
36
        $container = $this->addShipmentClient($container);
37
38
        return $container;
39
    }
40
41
    /**
42
     * @param \Spryker\Yves\Kernel\Container $container
43
     *
44
     * @return \Spryker\Yves\Kernel\Container
45
     */
46
    protected function addCurrencyPlugin(Container $container)
47
    {
48
        $container[static::PLUGIN_CURRENCY] = function (Container $container) {
0 ignored issues
show
Unused Code introduced by
The parameter $container is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

48
        $container[static::PLUGIN_CURRENCY] = function (/** @scrutinizer ignore-unused */ Container $container) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
49
            return new CurrencyPlugin();
50
        };
51
52
        return $container;
53
    }
54
55
    /**
56
     * @param \Spryker\Yves\Kernel\Container $container
57
     *
58
     * @return \Spryker\Yves\Kernel\Container
59
     */
60
    protected function addQuoteClient(Container $container): Container
61
    {
62
        $container[static::CLIENT_QUOTE] = function (Container $container) {
63
            return new BraintreeToQuoteClientBridge($container->getLocator()->quote()->client());
64
        };
65
66
        return $container;
67
    }
68
69
    /**
70
     * @param \Spryker\Yves\Kernel\Container $container
71
     *
72
     * @return \Spryker\Yves\Kernel\Container
73
     */
74
    protected function addUtilEncodingService(Container $container): Container
75
    {
76
        $container[static::SERVICE_UTIL_ENCODING] = function (Container $container) {
77
            return new BraintreeToUtilEncodingServiceBridge($container->getLocator()->utilEncoding()->service());
78
        };
79
80
        return $container;
81
    }
82
83
    /**
84
     * @param \Spryker\Yves\Kernel\Container $container
85
     *
86
     * @return \Spryker\Yves\Kernel\Container
87
     */
88
    protected function addShipmentClient(Container $container): Container
89
    {
90
        $container[static::CLIENT_SHIPMENT] = function (Container $container) {
91
            return new BraintreeToShipmentClientBridge($container->getLocator()->shipment()->client());
92
        };
93
94
        return $container;
95
    }
96
}
97