1 | <?php |
||
21 | abstract class AbstractRequest |
||
22 | implements RequestInterface, InputInterface |
||
23 | { |
||
24 | /** |
||
25 | * Headers |
||
26 | * |
||
27 | * @var array |
||
28 | * @access protected |
||
29 | */ |
||
30 | protected $headers; |
||
31 | |||
32 | /** |
||
33 | * Request data |
||
34 | * |
||
35 | * @var array |
||
36 | * @access protected |
||
37 | */ |
||
38 | protected $data; |
||
39 | |||
40 | /** |
||
41 | * Request URL |
||
42 | * |
||
43 | * @var string |
||
44 | * @access protected |
||
45 | */ |
||
46 | protected $url; |
||
47 | |||
48 | /** |
||
49 | * Request method |
||
50 | * |
||
51 | * @var string |
||
52 | * @access protected |
||
53 | */ |
||
54 | protected $method; |
||
55 | |||
56 | /** |
||
57 | * Timeout period |
||
58 | * |
||
59 | * @var int |
||
60 | * @access protected |
||
61 | */ |
||
62 | protected $timeout; |
||
63 | |||
64 | /** |
||
65 | * Page load delay time. |
||
66 | * |
||
67 | * @var int |
||
68 | * @access protected |
||
69 | */ |
||
70 | protected $delay; |
||
71 | |||
72 | /** |
||
73 | * Viewport width. |
||
74 | * |
||
75 | * @var int |
||
76 | * @access protected |
||
77 | */ |
||
78 | protected $viewportWidth; |
||
79 | |||
80 | /** |
||
81 | * Viewport height. |
||
82 | * |
||
83 | * @var int |
||
84 | * @access protected |
||
85 | */ |
||
86 | protected $viewportHeight; |
||
87 | |||
88 | /** |
||
89 | * Body styles. |
||
90 | * |
||
91 | * @var int |
||
92 | * @access protected |
||
93 | */ |
||
94 | protected $bodyStyles; |
||
95 | |||
96 | /** |
||
97 | * Internal constructor |
||
98 | * |
||
99 | * @access public |
||
100 | * @param string $url (default: null) |
||
101 | * @param string $method (default: RequestInterface::METHOD_GET) |
||
102 | * @param int $timeout (default: 5000) |
||
103 | */ |
||
104 | 113 | public function __construct($url = null, $method = RequestInterface::METHOD_GET, $timeout = 5000) |
|
120 | |||
121 | /** |
||
122 | * Set request method |
||
123 | * |
||
124 | * @access public |
||
125 | * @param string $method |
||
126 | * @return \JonnyW\PhantomJs\Http\AbstractRequest |
||
127 | * @throws \JonnyW\PhantomJs\Exception\InvalidMethodException |
||
128 | */ |
||
129 | 113 | public function setMethod($method) |
|
142 | |||
143 | /** |
||
144 | * Get request method |
||
145 | * |
||
146 | * @access public |
||
147 | * @return string |
||
148 | */ |
||
149 | 56 | public function getMethod() |
|
153 | |||
154 | /** |
||
155 | * Set timeout period |
||
156 | * |
||
157 | * @access public |
||
158 | * @param int $timeout |
||
159 | * @return \JonnyW\PhantomJs\Http\AbstractRequest |
||
160 | */ |
||
161 | 113 | public function setTimeout($timeout) |
|
167 | |||
168 | /** |
||
169 | * Get timeout period |
||
170 | * |
||
171 | * @access public |
||
172 | * @return int |
||
173 | */ |
||
174 | 31 | public function getTimeout() |
|
178 | |||
179 | /** |
||
180 | * Set page load delay time (seconds). |
||
181 | * |
||
182 | * @access public |
||
183 | * @param int $delay |
||
184 | * @return \JonnyW\PhantomJs\Http\AbstractRequest |
||
185 | */ |
||
186 | 6 | public function setDelay($delay) |
|
192 | |||
193 | /** |
||
194 | * Get page load delay time (seconds). |
||
195 | * |
||
196 | * @access public |
||
197 | * @return int |
||
198 | */ |
||
199 | 25 | public function getDelay() |
|
203 | |||
204 | /** |
||
205 | * Set viewport size. |
||
206 | * |
||
207 | * @access public |
||
208 | * @param int $width |
||
209 | * @param int $height |
||
210 | * @return void |
||
211 | */ |
||
212 | 8 | public function setViewportSize($width, $height) |
|
219 | |||
220 | /** |
||
221 | * Get viewport width. |
||
222 | * |
||
223 | * @access public |
||
224 | * @return int |
||
225 | */ |
||
226 | 28 | public function getViewportWidth() |
|
230 | |||
231 | /** |
||
232 | * Get viewport height. |
||
233 | * |
||
234 | * @access public |
||
235 | * @return int |
||
236 | */ |
||
237 | 28 | public function getViewportHeight() |
|
241 | |||
242 | /** |
||
243 | * Set request URL |
||
244 | * |
||
245 | * @access public |
||
246 | * @param string $url |
||
247 | * @return \JonnyW\PhantomJs\Http\AbstractRequest |
||
248 | * @throws \JonnyW\PhantomJs\Exception\InvalidUrlException |
||
249 | */ |
||
250 | 52 | public function setUrl($url) |
|
260 | |||
261 | /** |
||
262 | * Get request URL |
||
263 | * - Assembles query string for GET |
||
264 | * and HEAD requests |
||
265 | * |
||
266 | * @access public |
||
267 | * @return string |
||
268 | */ |
||
269 | 42 | public function getUrl() |
|
285 | |||
286 | /** |
||
287 | * Get content body |
||
288 | * - Returns query string if not GET or HEAD |
||
289 | * |
||
290 | * @access public |
||
291 | * @return string |
||
292 | */ |
||
293 | 34 | public function getBody() |
|
301 | |||
302 | /** |
||
303 | * Set request data |
||
304 | * |
||
305 | * @access public |
||
306 | * @param array $data |
||
307 | * @return \JonnyW\PhantomJs\Http\AbstractRequest |
||
308 | */ |
||
309 | 29 | public function setRequestData(array $data) |
|
315 | |||
316 | /** |
||
317 | * Get request data |
||
318 | * |
||
319 | * @access public |
||
320 | * @param boolean $flat |
||
321 | * @return array |
||
322 | */ |
||
323 | 10 | public function getRequestData($flat = true) |
|
331 | |||
332 | /** |
||
333 | * Set headers |
||
334 | * |
||
335 | * @access public |
||
336 | * @param array $headers |
||
337 | * @return \JonnyW\PhantomJs\Http\AbstractRequest |
||
338 | */ |
||
339 | 9 | public function setHeaders(array $headers) |
|
343 | |||
344 | /** |
||
345 | * Add single header |
||
346 | * |
||
347 | * @access public |
||
348 | * @param string $header |
||
349 | * @param string $value |
||
350 | * @return \JonnyW\PhantomJs\Http\AbstractRequest |
||
351 | */ |
||
352 | 1 | public function addHeader($header, $value) |
|
358 | |||
359 | /** |
||
360 | * Merge headers with existing |
||
361 | * |
||
362 | * @access public |
||
363 | * @param array $headers |
||
364 | * @return \JonnyW\PhantomJs\Http\AbstractRequest |
||
365 | */ |
||
366 | 3 | public function addHeaders(array $headers) |
|
372 | |||
373 | /** |
||
374 | * Get request headers |
||
375 | * |
||
376 | * @access public |
||
377 | * @param string $format |
||
378 | * @return array |
||
379 | */ |
||
380 | 35 | public function getHeaders($format = 'default') |
|
388 | |||
389 | /** |
||
390 | * Set body styles |
||
391 | * |
||
392 | * @access public |
||
393 | * @param array $styles |
||
394 | * @return \JonnyW\PhantomJs\Http\AbstractRequest |
||
395 | */ |
||
396 | 1 | public function setBodyStyles(array $styles) |
|
402 | |||
403 | /** |
||
404 | * Get body styles |
||
405 | * |
||
406 | * @access public |
||
407 | * @param string $format (default: 'default') |
||
408 | * @return array |
||
409 | */ |
||
410 | 25 | public function getBodyStyles($format = 'default') |
|
418 | |||
419 | /** |
||
420 | * Flatten data into single |
||
421 | * dimensional array |
||
422 | * |
||
423 | * @access protected |
||
424 | * @param array $data |
||
425 | * @param string $prefix |
||
426 | * @param string $format |
||
427 | * @return array |
||
428 | */ |
||
429 | 7 | protected function flattenData(array $data, $prefix = '', $format = '%s') |
|
448 | } |
||
449 |
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..