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

Guzzle6Factory::createClient()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2.032

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 10
ccs 4
cts 5
cp 0.8
rs 9.4285
cc 2
eloc 5
nc 2
nop 1
crap 2.032
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