1 | <?php |
||
11 | class RestApiBrowser |
||
12 | { |
||
13 | /** @var HttpClient */ |
||
14 | private $httpClient; |
||
15 | |||
16 | /** @var RequestInterface */ |
||
17 | private $request; |
||
18 | |||
19 | /** @var ResponseInterface */ |
||
20 | private $response; |
||
21 | |||
22 | /** @var array */ |
||
23 | private $requestHeaders = []; |
||
24 | |||
25 | /** @var ResponseStorage */ |
||
26 | private $responseStorage; |
||
27 | |||
28 | /** @var string */ |
||
29 | private $host; |
||
30 | |||
31 | /** @var MessageFactoryDiscovery */ |
||
32 | private $messageFactory; |
||
33 | |||
34 | /** |
||
35 | * @param string $host |
||
36 | */ |
||
37 | public function __construct($host, HttpClient $httpClient = null) |
||
43 | |||
44 | /** |
||
45 | * Allow to override the httpClient to use yours with specific middleware for example |
||
46 | */ |
||
47 | public function useHttpClient(HttpClient $httpClient) |
||
48 | { |
||
49 | $this->httpClient = $httpClient; |
||
50 | } |
||
51 | |||
52 | /** |
||
53 | * @param ResponseStorage $responseStorage |
||
54 | */ |
||
55 | public function enableResponseStorage(ResponseStorage $responseStorage) |
||
56 | { |
||
57 | $this->responseStorage = $responseStorage; |
||
58 | } |
||
59 | |||
60 | /** |
||
61 | * @return ResponseInterface |
||
62 | */ |
||
63 | public function getResponse() |
||
64 | { |
||
65 | return $this->response; |
||
66 | } |
||
67 | |||
68 | /** |
||
69 | * @param ResponseInterface $response |
||
70 | */ |
||
71 | public function setResponse(ResponseInterface $response) |
||
72 | { |
||
73 | $this->response = $response; |
||
74 | } |
||
75 | |||
76 | public function getRequest() |
||
77 | { |
||
78 | return $this->request; |
||
79 | } |
||
80 | |||
81 | public function getRequestHeaders() |
||
82 | { |
||
83 | return $this->requestHeaders; |
||
84 | } |
||
85 | |||
86 | /** |
||
87 | * @param string $method |
||
88 | * @param string $uri |
||
89 | * @param string|array $body |
||
90 | */ |
||
91 | public function sendRequest($method, $uri, $body = null) |
||
104 | |||
105 | /** |
||
106 | * @param string $name |
||
107 | * @param string $value |
||
108 | */ |
||
109 | public function setRequestHeader($name, $value) |
||
110 | { |
||
114 | |||
115 | /** |
||
116 | * @param string $name |
||
117 | * @param string $value |
||
118 | */ |
||
119 | public function addRequestHeader($name, $value) |
||
127 | |||
128 | /** |
||
129 | * @param string $headerName |
||
130 | */ |
||
131 | private function removeRequestHeader($headerName) |
||
137 | |||
138 | /** |
||
139 | * @param string $uri |
||
140 | * |
||
141 | * @return bool |
||
142 | */ |
||
143 | private function hasHost($uri) |
||
147 | } |
||
148 |
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..