AbstractClient   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 4
dl 0
loc 16
rs 10
c 0
b 0
f 0

1 Method

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