Completed
Push — master ( 039bdb...90d49c )
by Yuichi
11s
created

Client::attachLogSubscriber()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 3

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 6
cts 6
cp 1
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 4
nc 2
nop 1
crap 3
1
<?php
2
3
namespace CybozuHttp;
4
5
use GuzzleHttp\Client as GuzzleClient;
6
use CybozuHttp\Exception\NotExistRequiredException;
7
8
/**
9
 * @author ochi51<[email protected]>
10
 */
11
class Client extends GuzzleClient
12
{
13
14
    /**
15
     * Client constructor.
16
     * @param array $config
17
     */
18 4
    public function __construct($config = [])
19
    {
20 4
        $config = new Config($config);
21 4
        if (!$config->hasRequired()) {
22 1
            throw new NotExistRequiredException();
23
        }
24
25 4
        parent::__construct($config->toGuzzleConfig());
26 4
    }
27
28
    /**
29
     * @param string $prefix
30
     */
31 1
    public function connectionTest($prefix = '/')
32
    {
33 1
        $this->request('GET', $prefix, ['allow_redirects' => false]);
34 1
    }
35
}
36