Completed
Push — develop ( 2c75a2...3f95e8 )
by Adam
08:12
created

AbstractClient   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 18
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 2
1
<?php
2
3
namespace IBM\Watson\Common;
4
5
use Http\Client\HttpClient;
6
use IBM\Watson\Common\Util\DiscoveryTrait;
7
8
/**
9
 * Abstract service client which all other service clients should extend from.
10
 */
11
abstract class AbstractClient
12
{
13
    use DiscoveryTrait;
14
15
    /**
16
     * @var \Http\Client\HttpClient|null
17
     */
18
    protected $httpClient;
19
20
    /**
21
     * @param \Http\Client\HttpClient|null $httpClient HTTP client to send requests.
22
     */
23
    public function __construct(
24
        HttpClient $httpClient = null
25
    ) {
26
        $this->httpClient = $httpClient ?: $this->discoverHttpClient();
27
    }
28
}
29