CoremediaDependencyProvider::addGuzzleClient()   A
last analyzed

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
 * Copyright © 2016-present Spryker Systems GmbH. All rights reserved.
5
 * Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
6
 */
7
8
namespace SprykerEco\Client\Coremedia;
9
10
use GuzzleHttp\Client;
11
use Spryker\Client\Kernel\AbstractDependencyProvider;
12
use Spryker\Client\Kernel\Container;
13
use SprykerEco\Client\Coremedia\Dependency\Guzzle\CoremediaToGuzzleBridge;
14
15
class CoremediaDependencyProvider extends AbstractDependencyProvider
16
{
17
    public const CLIENT_GUZZLE = 'CLIENT_GUZZLE';
18
19
    /**
20
     * @param \Spryker\Client\Kernel\Container $container
21
     *
22
     * @return \Spryker\Client\Kernel\Container
23
     */
24
    public function provideServiceLayerDependencies(Container $container): Container
25
    {
26
        $container = $this->addGuzzleClient($container);
27
28
        return $container;
29
    }
30
31
    /**
32
     * @param \Spryker\Client\Kernel\Container $container
33
     *
34
     * @return \Spryker\Client\Kernel\Container
35
     */
36
    protected function addGuzzleClient(Container $container): Container
37
    {
38
        $container->set(static::CLIENT_GUZZLE, function () {
39
            return new CoremediaToGuzzleBridge($this->createGuzzleHttpClient());
40
        });
41
42
        return $container;
43
    }
44
45
    /**
46
     * @return \GuzzleHttp\Client
47
     */
48
    protected function createGuzzleHttpClient(): Client
49
    {
50
        return new Client();
51
    }
52
}
53