1 | <?php |
||
19 | class Http |
||
20 | { |
||
21 | /** |
||
22 | * Options for the HTTP client. |
||
23 | * |
||
24 | * @var array|\ArrayAccess |
||
25 | * @since 1.0 |
||
26 | */ |
||
27 | protected $options; |
||
28 | |||
29 | /** |
||
30 | * The HTTP transport object to use in sending HTTP requests. |
||
31 | * |
||
32 | * @var TransportInterface |
||
33 | * @since 1.0 |
||
34 | */ |
||
35 | protected $transport; |
||
36 | |||
37 | /** |
||
38 | * Constructor. |
||
39 | * |
||
40 | * @param array|\ArrayAccess $options Client options array. If the registry contains any headers.* elements, |
||
41 | * these will be added to the request headers. |
||
42 | * @param TransportInterface $transport The HTTP transport object. |
||
43 | * |
||
44 | * @since 1.0 |
||
45 | * @throws \InvalidArgumentException |
||
46 | */ |
||
47 | public function __construct($options = array(), TransportInterface $transport = null) |
||
71 | |||
72 | /** |
||
73 | * Get an option from the HTTP client. |
||
74 | * |
||
75 | * @param string $key The name of the option to get. |
||
76 | * |
||
77 | * @return mixed The option value. |
||
78 | * |
||
79 | * @since 1.0 |
||
80 | */ |
||
81 | public function getOption($key) |
||
85 | |||
86 | /** |
||
87 | * Set an option for the HTTP client. |
||
88 | * |
||
89 | * @param string $key The name of the option to set. |
||
90 | * @param mixed $value The option value to set. |
||
91 | * |
||
92 | * @return Http This object for method chaining. |
||
93 | * |
||
94 | * @since 1.0 |
||
95 | */ |
||
96 | public function setOption($key, $value) |
||
102 | |||
103 | /** |
||
104 | * Method to send the OPTIONS command to the server. |
||
105 | * |
||
106 | * @param string|UriInterface $url The URI to the resource to request. |
||
107 | * @param array $headers An array of request headers to send with the request. |
||
108 | * @param integer $timeout Read timeout in seconds. |
||
109 | * |
||
110 | * @return Response |
||
111 | * |
||
112 | * @since 1.0 |
||
113 | */ |
||
114 | public function options($url, array $headers = array(), $timeout = null) |
||
118 | |||
119 | /** |
||
120 | * Method to send the HEAD command to the server. |
||
121 | * |
||
122 | * @param string|UriInterface $url The URI to the resource to request. |
||
123 | * @param array $headers An array of request headers to send with the request. |
||
124 | * @param integer $timeout Read timeout in seconds. |
||
125 | * |
||
126 | * @return Response |
||
127 | * |
||
128 | * @since 1.0 |
||
129 | */ |
||
130 | public function head($url, array $headers = array(), $timeout = null) |
||
134 | |||
135 | /** |
||
136 | * Method to send the GET command to the server. |
||
137 | * |
||
138 | * @param string|UriInterface $url The URI to the resource to request. |
||
139 | * @param array $headers An array of request headers to send with the request. |
||
140 | * @param integer $timeout Read timeout in seconds. |
||
141 | * |
||
142 | * @return Response |
||
143 | * |
||
144 | * @since 1.0 |
||
145 | */ |
||
146 | public function get($url, array $headers = array(), $timeout = null) |
||
150 | |||
151 | /** |
||
152 | * Method to send the POST command to the server. |
||
153 | * |
||
154 | * @param string|UriInterface $url The URI to the resource to request. |
||
155 | * @param mixed $data Either an associative array or a string to be sent with the request. |
||
156 | * @param array $headers An array of request headers to send with the request. |
||
157 | * @param integer $timeout Read timeout in seconds. |
||
158 | * |
||
159 | * @return Response |
||
160 | * |
||
161 | * @since 1.0 |
||
162 | */ |
||
163 | public function post($url, $data, array $headers = array(), $timeout = null) |
||
167 | |||
168 | /** |
||
169 | * Method to send the PUT command to the server. |
||
170 | * |
||
171 | * @param string|UriInterface $url The URI to the resource to request. |
||
172 | * @param mixed $data Either an associative array or a string to be sent with the request. |
||
173 | * @param array $headers An array of request headers to send with the request. |
||
174 | * @param integer $timeout Read timeout in seconds. |
||
175 | * |
||
176 | * @return Response |
||
177 | * |
||
178 | * @since 1.0 |
||
179 | */ |
||
180 | public function put($url, $data, array $headers = array(), $timeout = null) |
||
184 | |||
185 | /** |
||
186 | * Method to send the DELETE command to the server. |
||
187 | * |
||
188 | * @param string|UriInterface $url The URI to the resource to request. |
||
189 | * @param array $headers An array of request headers to send with the request. |
||
190 | * @param integer $timeout Read timeout in seconds. |
||
191 | * @param mixed $data Either an associative array or a string to be sent with the request. |
||
192 | * |
||
193 | * @return Response |
||
194 | * |
||
195 | * @since 1.0 |
||
196 | */ |
||
197 | public function delete($url, array $headers = array(), $timeout = null, $data = null) |
||
201 | |||
202 | /** |
||
203 | * Method to send the TRACE command to the server. |
||
204 | * |
||
205 | * @param string|UriInterface $url The URI to the resource to request. |
||
206 | * @param array $headers An array of request headers to send with the request. |
||
207 | * @param integer $timeout Read timeout in seconds. |
||
208 | * |
||
209 | * @return Response |
||
210 | * |
||
211 | * @since 1.0 |
||
212 | */ |
||
213 | public function trace($url, array $headers = array(), $timeout = null) |
||
217 | |||
218 | /** |
||
219 | * Method to send the PATCH command to the server. |
||
220 | * |
||
221 | * @param string|UriInterface $url The URI to the resource to request. |
||
222 | * @param mixed $data Either an associative array or a string to be sent with the request. |
||
223 | * @param array $headers An array of request headers to send with the request. |
||
224 | * @param integer $timeout Read timeout in seconds. |
||
225 | * |
||
226 | * @return Response |
||
227 | * |
||
228 | * @since 1.0 |
||
229 | */ |
||
230 | public function patch($url, $data, array $headers = array(), $timeout = null) |
||
234 | |||
235 | /** |
||
236 | * Send a request to the server and return a Response object with the response. |
||
237 | * |
||
238 | * @param string $method The HTTP method for sending the request. |
||
239 | * @param string|UriInterface $url The URI to the resource to request. |
||
240 | * @param mixed $data Either an associative array or a string to be sent with the request. |
||
241 | * @param array $headers An array of request headers to send with the request. |
||
242 | * @param integer $timeout Read timeout in seconds. |
||
243 | * |
||
244 | * @return Response |
||
245 | * |
||
246 | * @since 1.0 |
||
247 | * @throws \InvalidArgumentException |
||
248 | */ |
||
249 | protected function makeTransportRequest($method, $url, $data = null, array $headers = array(), $timeout = null) |
||
285 | } |
||
286 |
This error could be the result of:
1. Missing dependencies
PHP Analyzer uses your
composer.json
file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects thecomposer.json
to be in the root folder of your repository.Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the
require
orrequire-dev
section?2. Missing use statement
PHP does not complain about undefined classes in
ìnstanceof
checks. For example, the following PHP code will work perfectly fine:If you have not tested against this specific condition, such errors might go unnoticed.