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

Client   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 3
dl 0
loc 25
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 2
A connectionTest() 0 4 1
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