Completed
Pull Request — master (#9)
by Volodymyr
09:05 queued 04:59
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\Service\BraintreeToUtilEncodingServiceBridge;
15
16
class BraintreeDependencyProvider extends AbstractBundleDependencyProvider
17
{
18
    public const PLUGIN_CURRENCY = 'PLUGIN_CURRENCY';
19
    public const CLIENT_QUOTE = 'QUOTE_CLIENT';
20
    public const SERVICE_UTIL_ENCODING = 'UTIL_ENCODING_SERVICE';
21
22
    /**
23
     * @param \Spryker\Yves\Kernel\Container $container
24
     *
25
     * @return \Spryker\Yves\Kernel\Container|\Spryker\Zed\Kernel\Container
26
     */
27
    public function provideDependencies(Container $container)
28
    {
29
        $container = $this->addCurrencyPlugin($container);
30
        $container = $this->addQuoteClient($container);
31
        $container = $this->addUtilEncodingService($container);
32
33
        return $container;
34
    }
35
36
    /**
37
     * @param \Spryker\Yves\Kernel\Container $container
38
     *
39
     * @return \Spryker\Yves\Kernel\Container
40
     */
41
    protected function addCurrencyPlugin(Container $container)
42
    {
43
        $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

43
        $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...
44
            return new CurrencyPlugin();
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[static::CLIENT_QUOTE] = function (Container $container) {
58
            return new BraintreeToQuoteClientBridge($container->getLocator()->quote()->client());
59
        };
60
61
        return $container;
62
    }
63
64
    /**
65
     * @param \Spryker\Yves\Kernel\Container $container
66
     *
67
     * @return \Spryker\Yves\Kernel\Container
68
     */
69
    protected function addUtilEncodingService(Container $container): Container
70
    {
71
        $container[static::SERVICE_UTIL_ENCODING] = function (Container $container) {
72
            return new BraintreeToUtilEncodingServiceBridge($container->getLocator()->utilEncoding()->service());
73
        };
74
75
        return $container;
76
    }
77
}
78