Passed
Pull Request — feature/eco-2295/dev (#1)
by Aleksey
03:39 queued 01:40
created

CrefoPayApiDependencyProvider   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 62
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 18
dl 0
loc 62
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A provideBusinessLayerDependencies() 0 8 1
A addCrefoPayApiService() 0 7 1
A addUtilEncodingService() 0 7 1
A addCrefoPayApiHttpClient() 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\Zed\CrefoPayApi;
9
10
use Spryker\Zed\Kernel\AbstractBundleDependencyProvider;
0 ignored issues
show
Bug introduced by
The type Spryker\Zed\Kernel\Abstr...undleDependencyProvider was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
11
use Spryker\Zed\Kernel\Container;
0 ignored issues
show
Bug introduced by
The type Spryker\Zed\Kernel\Container was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
12
use SprykerEco\Zed\CrefoPayApi\Dependency\External\Guzzle\CrefoPayApiGuzzleHttpClientAdapter;
13
use SprykerEco\Zed\CrefoPayApi\Dependency\Service\CrefoPayApiToUtilEncodingServiceBridge;
14
15
class CrefoPayApiDependencyProvider extends AbstractBundleDependencyProvider
16
{
17
    public const SERVICE_UTIL_ENCODING = 'SERVICE_UTIL_ENCODING';
18
    public const SERVICE_CREFO_PAY_API = 'SERVICE_CREFO_PAY_API';
19
20
    public const CREFO_PAY_API_HTTP_CLIENT = 'CREFO_PAY_API_HTTP_CLIENT';
21
22
    /**
23
     * @param \Spryker\Zed\Kernel\Container $container
24
     *
25
     * @return \Spryker\Zed\Kernel\Container
26
     */
27
    public function provideBusinessLayerDependencies(Container $container): Container
28
    {
29
        $container = parent::provideBusinessLayerDependencies($container);
30
        $container = $this->addUtilEncodingService($container);
31
        $container = $this->addCrefoPayApiService($container);
32
        $container = $this->addCrefoPayApiHttpClient($container);
33
34
        return $container;
35
    }
36
37
    /**
38
     * @param \Spryker\Zed\Kernel\Container $container
39
     *
40
     * @return \Spryker\Zed\Kernel\Container
41
     */
42
    protected function addUtilEncodingService(Container $container): Container
43
    {
44
        $container[static::SERVICE_UTIL_ENCODING] = function (Container $container) {
45
            return new CrefoPayApiToUtilEncodingServiceBridge($container->getLocator()->utilEncoding()->service());
46
        };
47
48
        return $container;
49
    }
50
51
    /**
52
     * @param \Spryker\Zed\Kernel\Container $container
53
     *
54
     * @return \Spryker\Zed\Kernel\Container
55
     */
56
    protected function addCrefoPayApiService(Container $container): Container
57
    {
58
        $container[static::SERVICE_CREFO_PAY_API] = function (Container $container) {
59
            return $container->getLocator()->crefoPayApi()->service();
60
        };
61
62
        return $container;
63
    }
64
65
    /**
66
     * @param \Spryker\Zed\Kernel\Container $container
67
     *
68
     * @return \Spryker\Zed\Kernel\Container
69
     */
70
    protected function addCrefoPayApiHttpClient(Container $container): Container
71
    {
72
        $container[static::CREFO_PAY_API_HTTP_CLIENT] = function () {
73
            return new CrefoPayApiGuzzleHttpClientAdapter();
74
        };
75
76
        return $container;
77
    }
78
}
79