Completed
Push — Grotax-Grotax-patch-1 ( 7ff330 )
by Alex
02:18
created

GuzzleClientBuilder   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 2
dl 0
loc 42
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getClient() 0 4 1
A getMainClassName() 0 4 1
A getPackageName() 0 4 1
1
<?php
2
/*
3
 * This file is part of the feed-io package.
4
 *
5
 * (c) Alexandre Debril <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace FeedIo\Factory\Builder;
12
13
use FeedIo\Factory\ClientBuilderInterface;
14
use \FeedIo\Adapter\Guzzle\Client;
15
use \GuzzleHttp\Client as GuzzleClient;
16
17
/**
18
 * @package FeedIo
19
 */
20
class GuzzleClientBuilder implements ClientBuilderInterface
21
{
22
    /**
23
     * @var array
24
     */
25
    private $config = [];
26
27
    /**
28
     * @param array $config
29
     */
30 8
    public function __construct(array $config = [])
31
    {
32 8
        $this->config = $config;
33 8
    }
34
35
    /**
36
     * This method MUST return a \FeedIo\Adapter\ClientInterface instance
37
     * @return \FeedIo\Adapter\ClientInterface
38
     */
39 3
    public function getClient()
40
    {
41 3
        return new Client(new GuzzleClient($this->config));
42
    }
43
 
44
    /**
45
     * This method MUST return the name of the main class
46
     * @return string
47
     */
48 1
    public function getMainClassName()
49
    {
50 1
        return '\GuzzleHttp\Client';
51
    }
52
    
53
    /**
54
     * This method MUST return the name of the package name
55
     * @return string
56
     */
57 1
    public function getPackageName()
58
    {
59 1
        return 'guzzlehttp/guzzle';
60
    }
61
}
62