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

AbstractClient::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
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