Completed
Push — master ( 6a2de0...36e020 )
by Márk
37:44 queued 30:09
created

Guzzle6Factory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 80%

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 2
c 2
b 0
f 1
lcom 0
cbo 2
dl 0
loc 16
ccs 4
cts 5
cp 0.8
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A createClient() 0 10 2
1
<?php
2
3
namespace Http\HttplugBundle\ClientFactory;
4
5
use GuzzleHttp\Client;
6
use Http\Adapter\Guzzle6\Client as Adapter;
7
8
/**
9
 * @author Tobias Nyholm <[email protected]>
10
 */
11
class Guzzle6Factory implements ClientFactory
12
{
13
    /**
14
     * {@inheritdoc}
15
     */
16 1
    public function createClient(array $config = [])
17
    {
18 1
        if (!class_exists('Http\Adapter\Guzzle6\Client')) {
19
            throw new \LogicException('To use the Guzzle6 adapter you need to install the "php-http/guzzle6-adapter" package.');
20
        }
21
22 1
        $client = new Client($config);
23
24 1
        return new Adapter($client);
25
    }
26
}
27