1 | <?php |
||
12 | final class Client implements ClientInterface |
||
13 | { |
||
14 | |||
15 | /** |
||
16 | * @const Int Timeout for each request |
||
17 | */ |
||
18 | const TIMEOUT = 60; |
||
19 | |||
20 | /** |
||
21 | * @var Zend\Http\Client Instance |
||
22 | */ |
||
23 | private $zendClient; |
||
24 | |||
25 | 2 | public function __construct(ZendHttpClient $client = null) |
|
26 | { |
||
27 | 2 | $client = ($client instanceof ZendHttpClient) ? $client : new ZendHttpClient(); |
|
28 | |||
29 | 2 | $this->setZendClient($client); |
|
30 | 2 | } |
|
31 | |||
32 | 2 | public function setZendClient(ZendHttpClient $client) |
|
33 | { |
||
34 | 2 | $host = $client->getUri()->getHost(); |
|
35 | |||
36 | 2 | if (empty($host)) { |
|
37 | 1 | throw new ZendHttpRuntimeException( |
|
38 | 'Host not defined.' |
||
39 | 1 | ); |
|
40 | } |
||
41 | |||
42 | 2 | $this->zendClient = $client; |
|
|
|||
43 | |||
44 | 2 | return $this; |
|
45 | } |
||
46 | |||
47 | /** |
||
48 | * Get the Zend\Http\Client instance |
||
49 | * |
||
50 | * @return Zend\Http\Client |
||
51 | */ |
||
52 | 1 | public function getZendClient() |
|
56 | |||
57 | /** |
||
58 | * Perform the request to api server |
||
59 | * |
||
60 | * @param String $path Example: "/v1/endpoint" |
||
61 | * @param Array $headers |
||
62 | */ |
||
63 | private function doRequest($path, $headers = array()) |
||
80 | |||
81 | /** |
||
82 | * {@inheritdoc} |
||
83 | */ |
||
84 | public function get($path, array $data = array(), array $headers = array()) |
||
91 | |||
92 | /** |
||
93 | * {@inheritdoc} |
||
94 | */ |
||
95 | public function post($path, array $data, array $headers = array()) |
||
102 | |||
103 | /** |
||
104 | * {@inheritdoc} |
||
105 | */ |
||
106 | public function put($path, array $data, array $headers = array()) |
||
113 | |||
114 | /** |
||
115 | * {@inheritdoc} |
||
116 | */ |
||
117 | public function patch($path, array $data, array $headers = array()) |
||
124 | |||
125 | /** |
||
126 | * {@inheritdoc} |
||
127 | */ |
||
128 | public function delete($path, array $headers = array()) |
||
134 | |||
135 | } |
||
136 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..