PHP8
[m6w6/seekat] / http.stub.php
1 <?php
2 /**
3 * Extended HTTP support. Again.
4 *
5 * * Introduces the http namespace.
6 * * PHP stream based message bodies.
7 * * Encapsulated env request/response.
8 * * Modular client support.
9 */
10 namespace http;
11 use http;
12 /**
13 * The HTTP client. See http\Client\Curl's [options](http/Client/Curl#Options:) which is the only driver currently supported.
14 */
15 class Client implements \SplSubject, \Countable {
16 /**
17 * Debug callback's $data contains human readable text.
18 */
19 const DEBUG_INFO = 0;
20 /**
21 * Debug callback's $data contains data received.
22 */
23 const DEBUG_IN = 1;
24 /**
25 * Debug callback's $data contains data sent.
26 */
27 const DEBUG_OUT = 2;
28 /**
29 * Debug callback's $data contains headers.
30 */
31 const DEBUG_HEADER = 16;
32 /**
33 * Debug callback's $data contains a body part.
34 */
35 const DEBUG_BODY = 32;
36 /**
37 * Debug callback's $data contains SSL data.
38 */
39 const DEBUG_SSL = 64;
40 /**
41 * Attached observers.
42 *
43 * @private
44 * @var \SplObjectStorage
45 */
46 private $observers = NULL;
47 /**
48 * Set options.
49 *
50 * @protected
51 * @var array
52 */
53 protected $options = NULL;
54 /**
55 * Request/response history.
56 *
57 * @protected
58 * @var \http\Message
59 */
60 protected $history = NULL;
61 /**
62 * Whether to record history in http\Client::$history.
63 *
64 * @public
65 * @var bool
66 */
67 public $recordHistory = false;
68 /**
69 * Create a new HTTP client.
70 *
71 * Currently only "curl" is supported as a $driver, and used by default.
72 * Persisted resources identified by $persistent_handle_id will be re-used if available.
73 *
74 * @param string $driver The HTTP client driver to employ. Currently only the default driver, "curl", is supported.
75 * @param string $persistent_handle_id If supplied, created curl handles will be persisted with this identifier for later reuse.
76 * @throws \http\Exception\InvalidArgumentException
77 * @throws \http\Exception\UnexpectedValueException
78 * @throws \http\Exception\RuntimeException
79 */
80 function __construct(string $driver = NULL, string $persistent_handle_id = NULL) {}
81 /**
82 * Add custom cookies.
83 * See http\Client::setCookies().
84 *
85 * @param array $cookies Custom cookies to add.
86 * @throws \http\Exception\InvalidArgumentException
87 * @return \http\Client self.
88 */
89 function addCookies(array $cookies = NULL) {}
90 /**
91 * Add specific SSL options.
92 * See http\Client::setSslOptions(), http\Client::setOptions() and http\Client\Curl\$ssl options.
93 *
94 * @param array $ssl_options Add this SSL options.
95 * @throws \http\Exception\InvalidArgumentException
96 * @return \http\Client self.
97 */
98 function addSslOptions(array $ssl_options = NULL) {}
99 /**
100 * Implements SplSubject. Attach another observer.
101 * Attached observers will be notified with progress of each transfer.
102 *
103 * @param \SplObserver $observer An implementation of SplObserver.
104 * @throws \http\Exception\InvalidArgumentException
105 * @throws \http\Exception\UnexpectedValueException
106 * @return \http\Client self.
107 */
108 function attach(\SplObserver $observer) {}
109 /**
110 * Configure the client's low level options.
111 *
112 * > ***NOTE:***
113 * > This method has been added in v2.3.0.
114 *
115 * @param array $configuration Key/value pairs of low level options.
116 * See f.e. the [configuration options for the Curl driver](http/Client/Curl#Configuration:).
117 * @throws \http\Exception\InvalidArgumentException
118 * @throws \http\Exception\UnexpectedValueException
119 * @return \http\Client self.
120 */
121 function configure(array $configuration) {}
122 /**
123 * Implements Countable. Retrieve the number of enqueued requests.
124 *
125 * > ***NOTE:***
126 * > The enqueued requests are counted without regard whether they are finished or not.
127 *
128 * @return int number of enqueued requests.
129 */
130 function count() {}
131 /**
132 * Dequeue the http\Client\Request $request.
133 *
134 * See http\Client::requeue(), if you want to requeue the request, instead of calling http\Client::dequeue() and then http\Client::enqueue().
135 *
136 * @param \http\Client\Request $request The request to cancel.
137 * @throws \http\Exception\InvalidArgumentException
138 * @throws \http\Exception\BadMethodCallException
139 * @throws \http\Exception\RuntimeException
140 * @return \http\Client self.
141 */
142 function dequeue(\http\Client\Request $request) {}
143 /**
144 * Implements SplSubject. Detach $observer, which has been previously attached.
145 *
146 * @param \SplObserver $observer Previously attached instance of SplObserver implementation.
147 * @throws \http\Exception\InvalidArgumentException
148 * @throws \http\Exception\UnexpectedValueException
149 * @return \http\Client self.
150 */
151 function detach(\SplObserver $observer) {}
152 /**
153 * Enable usage of an event library like libevent, which might improve performance with big socket sets.
154 *
155 * > ***NOTE:***
156 * > This method has been deprecated in 2.3.0, please use http\Client::configure() instead.
157 *
158 * @param bool $enable Whether to enable libevent usage.
159 * @throws \http\Exception\InvalidArgumentException
160 * @throws \http\Exception\UnexpectedValueException
161 * @return \http\Client self.
162 * @deprecated
163 */
164 function enableEvents(bool $enable = true) {}
165 /**
166 * Enable sending pipelined requests to the same host if the driver supports it.
167 *
168 * > ***NOTE:***
169 * > This method has been deprecated in 2.3.0, please use http\Client::configure() instead.
170 *
171 * @param bool $enable Whether to enable pipelining.
172 * @throws \http\Exception\InvalidArgumentException
173 * @throws \http\Exception\UnexpectedValueException
174 * @return \http\Client self.
175 * @deprecated
176 */
177 function enablePipelining(bool $enable = true) {}
178 /**
179 * Add another http\Client\Request to the request queue.
180 * If the optional callback $cb returns true, the request will be automatically dequeued.
181 *
182 * > ***Note:***
183 * > The http\Client\Response object resulting from the request is always stored
184 * > internally to be retrieved at a later time, __even__ when $cb is used.
185 * >
186 * > If you are about to send a lot of requests and do __not__ need the response
187 * > after executing the callback, you can use http\Client::getResponse() within
188 * > the callback to keep the memory usage level as low as possible.
189 *
190 * See http\Client::dequeue() and http\Client::send().
191 *
192 * @param \http\Client\Request $request The request to enqueue.
193 * @param callable $cb as function(\http\Response $response) : ?bool
194 * A callback to automatically call when the request has finished.
195 * @throws \http\Exception\InvalidArgumentException
196 * @throws \http\Exception\BadMethodCallException
197 * @throws \http\Exception\RuntimeException
198 * @return \http\Client self.
199 */
200 function enqueue(\http\Client\Request $request, callable $cb = NULL) {}
201 /**
202 * Get a list of available configuration options and their default values.
203 *
204 * See f.e. the [configuration options for the Curl driver](http/Client/Curl#Configuration:).
205 *
206 * @throws \http\Exception\InvalidArgumentException
207 * @return array list of key/value pairs of available configuration options and their default values.
208 */
209 function getAvailableConfiguration() {}
210 /**
211 * List available drivers.
212 *
213 * @return array list of supported drivers.
214 */
215 function getAvailableDrivers() {}
216 /**
217 * Retrieve a list of available request options and their default values.
218 *
219 * See f.e. the [request options for the Curl driver](http/Client/Curl#Options:).
220 *
221 * @throws \http\Exception\InvalidArgumentException
222 * @return array list of key/value pairs of available request options and their default values.
223 */
224 function getAvailableOptions() {}
225 /**
226 * Get priorly set custom cookies.
227 * See http\Client::setCookies().
228 *
229 * @return array custom cookies.
230 */
231 function getCookies() {}
232 /**
233 * Simply returns the http\Message chain representing the request/response history.
234 *
235 * > ***NOTE:***
236 * > The history is only recorded while http\Client::$recordHistory is true.
237 *
238 * @throws \http\Exception\InvalidArgumentException
239 * @return \http\Message the request/response message chain representing the client's history.
240 */
241 function getHistory() {}
242 /**
243 * Returns the SplObjectStorage holding attached observers.
244 *
245 * @throws \http\Exception\InvalidArgumentException
246 * @throws \http\Exception\UnexpectedValueException
247 * @return \SplObjectStorage observer storage.
248 */
249 function getObservers() {}
250 /**
251 * Get priorly set options.
252 * See http\Client::setOptions().
253 *
254 * @return array options.
255 */
256 function getOptions() {}
257 /**
258 * Retrieve the progress information for $request.
259 *
260 * @param \http\Client\Request $request The request to retrieve the current progress information for.
261 * @throws \http\Exception\InvalidArgumentException
262 * @throws \http\Exception\UnexpectedValueException
263 * @return object|NULL object stdClass instance holding progress information.
264 * or NULL if $request is not enqueued.
265 */
266 function getProgressInfo(\http\Client\Request $request) {}
267 /**
268 * Retrieve the corresponding response of an already finished request, or the last received response if $request is not set.
269 *
270 * > ***NOTE:***
271 * > If $request is NULL, then the response is removed from the internal storage (stack-like operation).
272 *
273 * @param \http\Client\Request $request The request to fetch the stored response for.
274 * @throws \http\Exception\InvalidArgumentException
275 * @throws \http\Exception\UnexpectedValueException
276 * @return \http\Client\Response|NULL \http\Client\Response the stored response for the request, or the last that was received.
277 * or NULL if no more response was available to pop, when no $request was given.
278 */
279 function getResponse(\http\Client\Request $request = NULL) {}
280 /**
281 * Retrieve priorly set SSL options.
282 * See http\Client::getOptions() and http\Client::setSslOptions().
283 *
284 * @return array SSL options.
285 */
286 function getSslOptions() {}
287 /**
288 * Get transfer related information for a running or finished request.
289 *
290 * @param \http\Client\Request $request The request to probe for transfer info.
291 * @throws \http\Exception\InvalidArgumentException
292 * @throws \http\Exception\UnexpectedValueException
293 * @return object stdClass instance holding transfer related information.
294 */
295 function getTransferInfo(\http\Client\Request $request) {}
296 /**
297 * Implements SplSubject. Notify attached observers about progress with $request.
298 *
299 * @param \http\Client\Request $request The request to notify about.
300 * @param object $progress stdClass instance holding progress information.
301 * @throws \http\Exception\InvalidArgumentException
302 * @throws \http\Exception\UnexpectedValueException
303 * @return \http\Client self.
304 */
305 function notify(\http\Client\Request $request = NULL, $progress = NULL) {}
306 /**
307 * Perform outstanding transfer actions.
308 * See http\Client::wait() for the completing interface.
309 *
310 * @return bool true if there are more transfers to complete.
311 */
312 function once() {}
313 /**
314 * Requeue an http\Client\Request.
315 *
316 * The difference simply is, that this method, in contrast to http\Client::enqueue(), does not throw an http\Exception when the request to queue is already enqueued and dequeues it automatically prior enqueueing it again.
317 *
318 * @param \http\Client\Request $request The request to queue.
319 * @param callable $cb as function(\http\Response $response) : ?bool
320 * A callback to automatically call when the request has finished.
321 * @throws \http\Exception\InvalidArgumentException
322 * @throws \http\Exception\RuntimeException
323 * @return \http\Client self.
324 */
325 function requeue(\http\Client\Request $request, callable $cb = NULL) {}
326 /**
327 * Reset the client to the initial state.
328 *
329 * @return \http\Client self.
330 */
331 function reset() {}
332 /**
333 * Send all enqueued requests.
334 * See http\Client::once() and http\Client::wait() for a more fine grained interface.
335 *
336 * @throws \http\Exception\InvalidArgumentException
337 * @throws \http\Exception\RuntimeException
338 * @return \http\Client self.
339 */
340 function send() {}
341 /**
342 * Set custom cookies.
343 * See http\Client::addCookies() and http\Client::getCookies().
344 *
345 * @param array $cookies Set the custom cookies to this array.
346 * @throws \http\Exception\InvalidArgumentException
347 * @return \http\Client self.
348 */
349 function setCookies(array $cookies = NULL) {}
350 /**
351 * Set client debugging callback.
352 *
353 * > ***NOTE:***
354 * > This method has been added in v2.6.0, resp. v3.1.0.
355 *
356 * @param callable $callback as function(http\Client $c, http\Client\Request $r, int $type, string $data)
357 * The debug callback. For $type see http\Client::DEBUG_* constants.
358 * @throws \http\Exception\InvalidArgumentException
359 * @return \http\Client self.
360 */
361 function setDebug(callable $callback) {}
362 /**
363 * Set client options.
364 * See http\Client\Curl.
365 *
366 * > ***NOTE:***
367 * > Only options specified prior enqueueing a request are applied to the request.
368 *
369 * @param array $options The options to set.
370 * @throws \http\Exception\InvalidArgumentException
371 * @return \http\Client self.
372 */
373 function setOptions(array $options = NULL) {}
374 /**
375 * Specifically set SSL options.
376 * See http\Client::setOptions() and http\Client\Curl\$ssl options.
377 *
378 * @param array $ssl_options Set SSL options to this array.
379 * @throws \http\Exception\InvalidArgumentException
380 * @return \http\Client self.
381 */
382 function setSslOptions(array $ssl_options = NULL) {}
383 /**
384 * Wait for $timeout seconds for transfers to provide data.
385 * This is the completion call to http\Client::once().
386 *
387 * @param float $timeout Seconds to wait for data on open sockets.
388 * @return bool success.
389 */
390 function wait(float $timeout = 0) {}
391 }
392 /**
393 * A class representing a list of cookies with specific attributes.
394 */
395 class Cookie {
396 /**
397 * Do not decode cookie contents.
398 */
399 const PARSE_RAW = 1;
400 /**
401 * The cookies' flags have the secure attribute set.
402 */
403 const SECURE = 16;
404 /**
405 * The cookies' flags have the httpOnly attribute set.
406 */
407 const HTTPONLY = 32;
408 /**
409 * Create a new cookie list.
410 *
411 * @param mixed $cookies The string or list of cookies to parse or set.
412 * @param int $flags Parse flags. See http\Cookie::PARSE_* constants.
413 * @param array $allowed_extras List of extra attribute names to recognize.
414 * @throws \http\Exception\InvalidArgumentException
415 * @throws \http\Exception\RuntimeException
416 */
417 function __construct($cookies = NULL, int $flags = 0, array $allowed_extras = NULL) {}
418 /**
419 * String cast handler. Alias of http\Cookie::toString().
420 *
421 * @return string the cookie(s) represented as string.
422 */
423 function __toString() {}
424 /**
425 * Add a cookie.
426 * See http\Cookie::setCookie() and http\Cookie::addCookies().
427 *
428 * @param string $cookie_name The key of the cookie.
429 * @param string $cookie_value The value of the cookie.
430 * @throws \http\Exception\InvalidArgumentException
431 * @return \http\Cookie self.
432 */
433 function addCookie(string $cookie_name, string $cookie_value) {}
434 /**
435 * (Re)set the cookies.
436 * See http\Cookie::setCookies().
437 *
438 * @param array $cookies Add cookies of this array of form ["name" => "value"].
439 * @throws \http\Exception\InvalidArgumentException
440 * @return \http\Cookie self.
441 */
442 function addCookies(array $cookies) {}
443 /**
444 * Add an extra attribute to the cookie list.
445 * See http\Cookie::setExtra().
446 *
447 * @param string $extra_name The key of the extra attribute.
448 * @param string $extra_value The value of the extra attribute.
449 * @throws \http\Exception\InvalidArgumentException
450 * @return \http\Cookie self.
451 */
452 function addExtra(string $extra_name, string $extra_value) {}
453 /**
454 * Add several extra attributes.
455 * See http\Cookie::addExtra().
456 *
457 * @param array $extras A list of extra attributes of the form ["key" => "value"].
458 * @throws \http\Exception\InvalidArgumentException
459 * @return \http\Cookie self.
460 */
461 function addExtras(array $extras) {}
462 /**
463 * Retrieve a specific cookie value.
464 * See http\Cookie::setCookie().
465 *
466 * @param string $cookie_name The key of the cookie to look up.
467 * @return string|NULL string the cookie value.
468 * or NULL if $cookie_name could not be found.
469 */
470 function getCookie(string $cookie_name) {}
471 /**
472 * Get the list of cookies.
473 * See http\Cookie::setCookies().
474 *
475 * @return array the list of cookies of form ["name" => "value"].
476 */
477 function getCookies() {}
478 /**
479 * Retrieve the effective domain of the cookie list.
480 * See http\Cookie::setDomain().
481 *
482 * @return string the effective domain.
483 */
484 function getDomain() {}
485 /**
486 * Get the currently set expires attribute.
487 * See http\Cookie::setExpires().
488 *
489 * > ***NOTE:***
490 * > A return value of -1 means that the attribute is not set.
491 *
492 * @return int the currently set expires attribute as seconds since the epoch.
493 */
494 function getExpires() {}
495 /**
496 * Retrieve an extra attribute.
497 * See http\Cookie::setExtra().
498 *
499 * @param string $name The key of the extra attribute.
500 * @return string the value of the extra attribute.
501 */
502 function getExtra(string $name) {}
503 /**
504 * Retrieve the list of extra attributes.
505 * See http\Cookie::setExtras().
506 *
507 * @return array the list of extra attributes of the form ["key" => "value"].
508 */
509 function getExtras() {}
510 /**
511 * Get the currently set flags.
512 * See http\Cookie::SECURE and http\Cookie::HTTPONLY constants.
513 *
514 * @return int the currently set flags bitmask.
515 */
516 function getFlags() {}
517 /**
518 * Get the currently set max-age attribute of the cookie list.
519 * See http\Cookie::setMaxAge().
520 *
521 * > ***NOTE:***
522 * > A return value of -1 means that the attribute is not set.
523 *
524 * @return int the currently set max-age.
525 */
526 function getMaxAge() {}
527 /**
528 * Retrieve the path the cookie(s) of this cookie list are effective at.
529 * See http\Cookie::setPath().
530 *
531 * @return string the effective path.
532 */
533 function getPath() {}
534 /**
535 * (Re)set a cookie.
536 * See http\Cookie::addCookie() and http\Cookie::setCookies().
537 *
538 * > ***NOTE:***
539 * > The cookie will be deleted from the list if $cookie_value is NULL.
540 *
541 * @param string $cookie_name The key of the cookie.
542 * @param string $cookie_value The value of the cookie.
543 * @throws \http\Exception\InvalidArgumentException
544 * @return \http\Cookie self.
545 */
546 function setCookie(string $cookie_name, string $cookie_value) {}
547 /**
548 * (Re)set the cookies.
549 * See http\Cookie::addCookies().
550 *
551 * @param array $cookies Set the cookies to this array.
552 * @throws \http\Exception\InvalidArgumentException
553 * @return \http\Cookie self.
554 */
555 function setCookies(array $cookies = NULL) {}
556 /**
557 * Set the effective domain of the cookie list.
558 * See http\Cookie::setPath().
559 *
560 * @param string $value The domain the cookie(s) belong to.
561 * @throws \http\Exception\InvalidArgumentException
562 * @return \http\Cookie self.
563 */
564 function setDomain(string $value = NULL) {}
565 /**
566 * Set the traditional expires timestamp.
567 * See http\Cookie::setMaxAge() for a safer alternative.
568 *
569 * @param int $value The expires timestamp as seconds since the epoch.
570 * @throws \http\Exception\InvalidArgumentException
571 * @return \http\Cookie self.
572 */
573 function setExpires(int $value = -1) {}
574 /**
575 * (Re)set an extra attribute.
576 * See http\Cookie::addExtra().
577 *
578 * > ***NOTE:***
579 * > The attribute will be removed from the extras list if $extra_value is NULL.
580 *
581 * @param string $extra_name The key of the extra attribute.
582 * @param string $extra_value The value of the extra attribute.
583 * @throws \http\Exception\InvalidArgumentException
584 * @return \http\Cookie self.
585 */
586 function setExtra(string $extra_name, string $extra_value = NULL) {}
587 /**
588 * (Re)set the extra attributes.
589 * See http\Cookie::addExtras().
590 *
591 * @param array $extras Set the extra attributes to this array.
592 * @throws \http\Exception\InvalidArgumentException
593 * @return \http\Cookie self.
594 */
595 function setExtras(array $extras = NULL) {}
596 /**
597 * Set the flags to specified $value.
598 * See http\Cookie::SECURE and http\Cookie::HTTPONLY constants.
599 *
600 * @param int $value The new flags bitmask.
601 * @throws \http\Exception\InvalidArgumentException
602 * @return \http\Cookie self.
603 */
604 function setFlags(int $value = 0) {}
605 /**
606 * Set the maximum age the cookie may have on the client side.
607 * This is a client clock departure safe alternative to the "expires" attribute.
608 * See http\Cookie::setExpires().
609 *
610 * @param int $value The max-age in seconds.
611 * @throws \http\Exception\InvalidArgumentException
612 * @return \http\Cookie self.
613 */
614 function setMaxAge(int $value = -1) {}
615 /**
616 * Set the path the cookie(s) of this cookie list should be effective at.
617 * See http\Cookie::setDomain().
618 *
619 * @param string $path The URL path the cookie(s) should take effect within.
620 * @throws \http\Exception\InvalidArgumentException
621 * @return \http\Cookie self.
622 */
623 function setPath(string $path = NULL) {}
624 /**
625 * Get the cookie list as array.
626 *
627 * @return array the cookie list as array.
628 */
629 function toArray() {}
630 /**
631 * Retrieve the string representation of the cookie list.
632 * See http\Cookie::toArray().
633 *
634 * @return string the cookie list as string.
635 */
636 function toString() {}
637 }
638 /**
639 *
640 */
641 namespace http\Encoding;
642 namespace http;
643 /**
644 * The http\Env class provides static methods to manipulate and inspect the server's current request's HTTP environment.
645 */
646 class Env {
647 /**
648 * Retrieve the current HTTP request's body.
649 *
650 * @param string $body_class_name A user class extending http\Message\Body.
651 * @throws \http\Exception\InvalidArgumentException
652 * @throws \http\Exception\UnexpectedValueException
653 * @return \http\Message\Body instance representing the request body
654 */
655 function getRequestBody(string $body_class_name = NULL) {}
656 /**
657 * Retrieve one or all headers of the current HTTP request.
658 *
659 * @param string $header_name The key of a header to retrieve.
660 * @return NULL|string|array NULL if $header_name was not found
661 * or string the compound header when $header_name was found
662 * or array of all headers if $header_name was not specified
663 */
664 function getRequestHeader(string $header_name = NULL) {}
665 /**
666 * Get the HTTP response code to send.
667 *
668 * @return int the HTTP response code.
669 */
670 function getResponseCode() {}
671 /**
672 * Get one or all HTTP response headers to be sent.
673 *
674 * @param string $header_name The name of the response header to retrieve.
675 * @return string|NULL|array string the compound value of the response header to send
676 * or NULL if the header was not found
677 * or array of all response headers, if $header_name was not specified
678 */
679 function getResponseHeader(string $header_name = NULL) {}
680 /**
681 * Retrieve a list of all known HTTP response status.
682 *
683 * @return array mapping of the form \[
684 * ...
685 * int $code => string $status
686 * ...
687 * \]
688 */
689 function getResponseStatusForAllCodes() {}
690 /**
691 * Retrieve the string representation of specified HTTP response code.
692 *
693 * @param int $code The HTTP response code to get the string representation for.
694 * @return string the HTTP response status message (may be empty, if no message for this code was found)
695 */
696 function getResponseStatusForCode(int $code) {}
697 /**
698 * Generic negotiator. For specific client negotiation see http\Env::negotiateContentType() and related methods.
699 *
700 * > ***NOTE:***
701 * > The first element of $supported serves as a default if no operand matches.
702 *
703 * @param string $params HTTP header parameter's value to negotiate.
704 * @param array $supported List of supported negotiation operands.
705 * @param string $prim_typ_sep A "primary type separator", i.e. that would be a hyphen for content language negotiation (en-US, de-DE, etc.).
706 * @param array $result Out parameter recording negotiation results.
707 * @return NULL|string NULL if negotiation fails.
708 * or string the closest match negotiated, or the default (first entry of $supported).
709 */
710 function negotiate(string $params, array $supported, string $prim_typ_sep = NULL, array &$result = NULL) {}
711 /**
712 * Negotiate the client's preferred character set.
713 *
714 * > ***NOTE:***
715 * > The first element of $supported character sets serves as a default if no character set matches.
716 *
717 * @param array $supported List of supported content character sets.
718 * @param array $result Out parameter recording negotiation results.
719 * @return NULL|string NULL if negotiation fails.
720 * or string the negotiated character set.
721 */
722 function negotiateCharset(array $supported, array &$result = NULL) {}
723 /**
724 * Negotiate the client's preferred MIME content type.
725 *
726 * > ***NOTE:***
727 * > The first element of $supported content types serves as a default if no content-type matches.
728 *
729 * @param array $supported List of supported MIME content types.
730 * @param array $result Out parameter recording negotiation results.
731 * @return NULL|string NULL if negotiation fails.
732 * or string the negotiated content type.
733 */
734 function negotiateContentType(array $supported, array &$result = NULL) {}
735 /**
736 * Negotiate the client's preferred encoding.
737 *
738 * > ***NOTE:***
739 * > The first element of $supported encodings serves as a default if no encoding matches.
740 *
741 * @param array $supported List of supported content encodings.
742 * @param array $result Out parameter recording negotiation results.
743 * @return NULL|string NULL if negotiation fails.
744 * or string the negotiated encoding.
745 */
746 function negotiateEncoding(array $supported, array &$result = NULL) {}
747 /**
748 * Negotiate the client's preferred language.
749 *
750 * > ***NOTE:***
751 * > The first element of $supported languages serves as a default if no language matches.
752 *
753 * @param array $supported List of supported content languages.
754 * @param array $result Out parameter recording negotiation results.
755 * @return NULL|string NULL if negotiation fails.
756 * or string the negotiated language.
757 */
758 function negotiateLanguage(array $supported, array &$result = NULL) {}
759 /**
760 * Set the HTTP response code to send.
761 *
762 * @param int $code The HTTP response status code.
763 * @return bool Success.
764 */
765 function setResponseCode(int $code) {}
766 /**
767 * Set a response header, either replacing a prior set header, or appending the new header value, depending on $replace.
768 *
769 * If no $header_value is specified, or $header_value is NULL, then a previously set header with the same key will be deleted from the list.
770 *
771 * If $response_code is not 0, the response status code is updated accordingly.
772 *
773 * @param string $header_name
774 * @param mixed $header_value
775 * @param int $response_code
776 * @param bool $replace
777 * @return bool Success.
778 */
779 function setResponseHeader(string $header_name, $header_value = NULL, int $response_code = NULL, bool $replace = NULL) {}
780 }
781 /**
782 * The http extension's Exception interface.
783 *
784 * Use it to catch any Exception thrown by pecl/http.
785 *
786 * The individual exception classes extend their equally named native PHP extensions, if such exist, and implement this empty interface. For example the http\Exception\BadMethodCallException extends SPL's BadMethodCallException.
787 */
788 interface Exception {
789 }
790 /**
791 * The http\Header class provides methods to manipulate, match, negotiate and serialize HTTP headers.
792 */
793 class Header implements \Serializable {
794 /**
795 * None of the following match constraints applies.
796 */
797 const MATCH_LOOSE = 0;
798 /**
799 * Perform case sensitive matching.
800 */
801 const MATCH_CASE = 1;
802 /**
803 * Match only on word boundaries (according by CType alpha-numeric).
804 */
805 const MATCH_WORD = 16;
806 /**
807 * Match the complete string.
808 */
809 const MATCH_FULL = 32;
810 /**
811 * Case sensitively match the full string (same as MATCH_CASE|MATCH_FULL).
812 */
813 const MATCH_STRICT = 33;
814 /**
815 * The name of the HTTP header.
816 *
817 * @public
818 * @var string
819 */
820 public $name = NULL;
821 /**
822 * The value of the HTTP header.
823 *
824 * @public
825 * @var mixed
826 */
827 public $value = NULL;
828 /**
829 * Create an http\Header instance for use of simple matching or negotiation. If the value of the header is an array it may be compounded to a single comma separated string.
830 *
831 * @param string $name The HTTP header name.
832 * @param mixed $value The value of the header.
833 *
834 * # Throws:
835 */
836 function __construct(string $name = NULL, $value = NULL) {}
837 /**
838 * String cast handler. Alias of http\Header::serialize().
839 *
840 * @return string the serialized form of the HTTP header (i.e. "Name: value").
841 */
842 function __toString() {}
843 /**
844 * Create a parameter list out of the HTTP header value.
845 *
846 * @param mixed $ps The parameter separator(s).
847 * @param mixed $as The argument separator(s).
848 * @param mixed $vs The value separator(s).
849 * @param int $flags The modus operandi. See http\Params constants.
850 * @return \http\Params instance
851 */
852 function getParams($ps = NULL, $as = NULL, $vs = NULL, int $flags = NULL) {}
853 /**
854 * Match the HTTP header's value against provided $value according to $flags.
855 *
856 * @param string $value The comparison value.
857 * @param int $flags The modus operandi. See http\Header constants.
858 * @return bool whether $value matches the header value according to $flags.
859 */
860 function match(string $value, int $flags = NULL) {}
861 /**
862 * Negotiate the header's value against a list of supported values in $supported.
863 * Negotiation operation is adopted according to the header name, i.e. if the
864 * header being negotiated is Accept, then a slash is used as primary type
865 * separator, and if the header is Accept-Language respectively, a hyphen is
866 * used instead.
867 *
868 * > ***NOTE:***
869 * > The first element of $supported serves as a default if no operand matches.
870 *
871 * @param array $supported The list of supported values to negotiate.
872 * @param array $result Out parameter recording the negotiation results.
873 * @return NULL|string NULL if negotiation fails.
874 * or string the closest match negotiated, or the default (first entry of $supported).
875 */
876 function negotiate(array $supported, array &$result = NULL) {}
877 /**
878 * Parse HTTP headers.
879 * See also http\Header\Parser.
880 *
881 * @param string $header The complete string of headers.
882 * @param string $header_class A class extending http\Header.
883 * @return array|false array of parsed headers, where the elements are instances of $header_class if specified.
884 * or false if parsing fails.
885 */
886 function parse(string $header, string $header_class = NULL) {}
887 /**
888 * Implements Serializable.
889 *
890 * @return string serialized representation of HTTP header (i.e. "Name: value")
891 */
892 function serialize() {}
893 /**
894 * Convenience method. Alias of http\Header::serialize().
895 *
896 * @return string the serialized form of the HTTP header (i.e. "Name: value").
897 */
898 function toString() {}
899 /**
900 * Implements Serializable.
901 *
902 * @param string $serialized The serialized HTTP header (i.e. "Name: value")
903 */
904 function unserialize($serialized) {}
905 }
906 /**
907 * The message class builds the foundation for any request and response message.
908 *
909 * See http\Client\Request and http\Client\Response, as well as http\Env\Request and http\Env\Response.
910 */
911 class Message implements \Countable, \Serializable, \Iterator {
912 /**
913 * No specific type of message.
914 */
915 const TYPE_NONE = 0;
916 /**
917 * A request message.
918 */
919 const TYPE_REQUEST = 1;
920 /**
921 * A response message.
922 */
923 const TYPE_RESPONSE = 2;
924 /**
925 * The message type. See http\Message::TYPE_* constants.
926 *
927 * @protected
928 * @var int
929 */
930 protected $type = \http\Message::TYPE_NONE;
931 /**
932 * The message's body.
933 *
934 * @protected
935 * @var \http\Message\Body
936 */
937 protected $body = NULL;
938 /**
939 * The request method if the message is of type request.
940 *
941 * @protected
942 * @var string
943 */
944 protected $requestMethod = "";
945 /**
946 * The request url if the message is of type request.
947 *
948 * @protected
949 * @var string
950 */
951 protected $requestUrl = "";
952 /**
953 * The response status phrase if the message is of type response.
954 *
955 * @protected
956 * @var string
957 */
958 protected $responseStatus = "";
959 /**
960 * The response code if the message is of type response.
961 *
962 * @protected
963 * @var int
964 */
965 protected $responseCode = 0;
966 /**
967 * A custom HTTP protocol version.
968 *
969 * @protected
970 * @var string
971 */
972 protected $httpVersion = NULL;
973 /**
974 * Any message headers.
975 *
976 * @protected
977 * @var array
978 */
979 protected $headers = NULL;
980 /**
981 * Any parent message.
982 *
983 * @protected
984 * @var \http\Message
985 */
986 protected $parentMessage;
987 /**
988 * Create a new HTTP message.
989 *
990 * @param mixed $message Either a resource or a string, representing the HTTP message.
991 * @param bool $greedy Whether to read from a $message resource until EOF.
992 * @throws \http\Exception\InvalidArgumentException
993 * @throws \http\Exception\BadMessageException
994 */
995 function __construct($message = NULL, bool $greedy = true) {}
996 /**
997 * Retrieve the message serialized to a string.
998 * Alias of http\Message::toString().
999 *
1000 * @return string the single serialized HTTP message.
1001 */
1002 function __toString() {}
1003 /**
1004 * Append the data of $body to the message's body.
1005 * See http\Message::setBody() and http\Message\Body::append().
1006 *
1007 * @param \http\Message\Body $body The message body to add.
1008 * @return \http\Message self.
1009 */
1010 function addBody(\http\Message\Body $body) {}
1011 /**
1012 * Add an header, appending to already existing headers.
1013 * See http\Message::addHeaders() and http\Message::setHeader().
1014 *
1015 * @param string $name The header name.
1016 * @param mixed $value The header value.
1017 * @return \http\Message self.
1018 */
1019 function addHeader(string $name, $value) {}
1020 /**
1021 * Add headers, optionally appending values, if header keys already exist.
1022 * See http\Message::addHeader() and http\Message::setHeaders().
1023 *
1024 * @param array $headers The HTTP headers to add.
1025 * @param bool $append Whether to append values for existing headers.
1026 * @return \http\Message self.
1027 */
1028 function addHeaders(array $headers, bool $append = false) {}
1029 /**
1030 * Implements Countable.
1031 *
1032 * @return int the count of messages in the chain above the current message.
1033 */
1034 function count() {}
1035 /**
1036 * Implements iterator.
1037 * See http\Message::valid() and http\Message::rewind().
1038 *
1039 * @return \http\Message the current message in the iterated message chain.
1040 */
1041 function current() {}
1042 /**
1043 * Detach a clone of this message from any message chain.
1044 *
1045 * @throws \http\Exception\InvalidArgumentException
1046 * @return \http\Message clone.
1047 */
1048 function detach() {}
1049 /**
1050 * Retrieve the message's body.
1051 * See http\Message::setBody().
1052 *
1053 * @throws \http\Exception\InvalidArgumentException
1054 * @throws \http\Exception\UnexpectedValueException
1055 * @return \http\Message\Body the message body.
1056 */
1057 function getBody() {}
1058 /**
1059 * Retrieve a single header, optionally hydrated into a http\Header extending class.
1060 *
1061 * @param string $header The header's name.
1062 * @param string $into_class The name of a class extending http\Header.
1063 * @return mixed|\http\Header mixed the header value if $into_class is NULL.
1064 * or \http\Header descendant.
1065 */
1066 function getHeader(string $header, string $into_class = NULL) {}
1067 /**
1068 * Retrieve all message headers.
1069 * See http\Message::setHeaders() and http\Message::getHeader().
1070 *
1071 * @return array the message's headers.
1072 */
1073 function getHeaders() {}
1074 /**
1075 * Retrieve the HTTP protocol version of the message.
1076 * See http\Message::setHttpVersion().
1077 *
1078 * @return string the HTTP protocol version, e.g. "1.0"; defaults to "1.1".
1079 */
1080 function getHttpVersion() {}
1081 /**
1082 * Retrieve the first line of a request or response message.
1083 * See http\Message::setInfo and also:
1084 *
1085 * * http\Message::getType()
1086 * * http\Message::getHttpVersion()
1087 * * http\Message::getResponseCode()
1088 * * http\Message::getResponseStatus()
1089 * * http\Message::getRequestMethod()
1090 * * http\Message::getRequestUrl()
1091 *
1092 * @return string|NULL string the HTTP message information.
1093 * or NULL if the message is neither of type request nor response.
1094 */
1095 function getInfo() {}
1096 /**
1097 * Retrieve any parent message.
1098 * See http\Message::reverse().
1099 *
1100 * @throws \http\Exception\InvalidArgumentException
1101 * @throws \http\Exception\BadMethodCallException
1102 * @return \http\Message the parent message.
1103 */
1104 function getParentMessage() {}
1105 /**
1106 * Retrieve the request method of the message.
1107 * See http\Message::setRequestMethod() and http\Message::getRequestUrl().
1108 *
1109 * @return string|false string the request method.
1110 * or false if the message was not of type request.
1111 */
1112 function getRequestMethod() {}
1113 /**
1114 * Retrieve the request URL of the message.
1115 * See http\Message::setRequestUrl().
1116 *
1117 * @return string|false string the request URL; usually the path and the querystring.
1118 * or false if the message was not of type request.
1119 */
1120 function getRequestUrl() {}
1121 /**
1122 * Retrieve the response code of the message.
1123 * See http\Message::setResponseCode() and http\Message::getResponseStatus().
1124 *
1125 * @return int|false int the response status code.
1126 * or false if the message is not of type response.
1127 */
1128 function getResponseCode() {}
1129 /**
1130 * Retrieve the response status of the message.
1131 * See http\Message::setResponseStatus() and http\Message::getResponseCode().
1132 *
1133 * @return string|false string the response status phrase.
1134 * or false if the message is not of type response.
1135 */
1136 function getResponseStatus() {}
1137 /**
1138 * Retrieve the type of the message.
1139 * See http\Message::setType() and http\Message::getInfo().
1140 *
1141 * @return int the message type. See http\Message::TYPE_* constants.
1142 */
1143 function getType() {}
1144 /**
1145 * Check whether this message is a multipart message based on it's content type.
1146 * If the message is a multipart message and a reference $boundary is given, the boundary string of the multipart message will be stored in $boundary.
1147 *
1148 * See http\Message::splitMultipartBody().
1149 *
1150 * @param string $boundary A reference where the boundary string will be stored.
1151 * @return bool whether this is a message with a multipart "Content-Type".
1152 */
1153 function isMultipart(string &$boundary = NULL) {}
1154 /**
1155 * Implements Iterator.
1156 * See http\Message::current() and http\Message::rewind().
1157 *
1158 * @return int a non-sequential integer key.
1159 */
1160 function key() {}
1161 /**
1162 * Implements Iterator.
1163 * See http\Message::valid() and http\Message::rewind().
1164 */
1165 function next() {}
1166 /**
1167 * Prepend message(s) $message to this message, or the top most message of this message chain.
1168 *
1169 * > ***NOTE:***
1170 * > The message chains must not overlap.
1171 *
1172 * @param \http\Message $message The message (chain) to prepend as parent messages.
1173 * @param bool $top Whether to prepend to the top-most parent message.
1174 * @throws \http\Exception\InvalidArgumentException
1175 * @throws \http\Exception\UnexpectedValueException
1176 * @return \http\Message self.
1177 */
1178 function prepend(\http\Message $message, bool $top = true) {}
1179 /**
1180 * Reverse the message chain and return the former top-most message.
1181 *
1182 * > ***NOTE:***
1183 * > Message chains are ordered in reverse-parsed order by default, i.e. the last parsed message is the message you'll receive from any call parsing HTTP messages.
1184 * >
1185 * > This call re-orders the messages of the chain and returns the message that was parsed first with any later parsed messages re-parentized.
1186 *
1187 * @throws \http\Exception\InvalidArgumentException
1188 * @return \http\Message the other end of the message chain.
1189 */
1190 function reverse() {}
1191 /**
1192 * Implements Iterator.
1193 */
1194 function rewind() {}
1195 /**
1196 * Implements Serializable.
1197 *
1198 * @return string the serialized HTTP message.
1199 */
1200 function serialize() {}
1201 /**
1202 * Set the message's body.
1203 * See http\Message::getBody() and http\Message::addBody().
1204 *
1205 * @param \http\Message\Body $body The new message body.
1206 * @throws \http\Exception\InvalidArgumentException
1207 * @throws \http\Exception\UnexpectedValueException
1208 * @return \http\Message self.
1209 */
1210 function setBody(\http\Message\Body $body) {}
1211 /**
1212 * Set a single header.
1213 * See http\Message::getHeader() and http\Message::addHeader().
1214 *
1215 * > ***NOTE:***
1216 * > Prior to v2.5.6/v3.1.0 headers with the same name were merged into a single
1217 * > header with values concatenated by comma.
1218 *
1219 * @param string $header The header's name.
1220 * @param mixed $value The header's value. Removes the header if NULL.
1221 * @return \http\Message self.
1222 */
1223 function setHeader(string $header, $value = NULL) {}
1224 /**
1225 * Set the message headers.
1226 * See http\Message::getHeaders() and http\Message::addHeaders().
1227 *
1228 * > ***NOTE:***
1229 * > Prior to v2.5.6/v3.1.0 headers with the same name were merged into a single
1230 * > header with values concatenated by comma.
1231 *
1232 * @param array $headers The message's headers.
1233 * @return \http\Message null.
1234 */
1235 function setHeaders(array $headers = NULL) {}
1236 /**
1237 * Set the HTTP protocol version of the message.
1238 * See http\Message::getHttpVersion().
1239 *
1240 * @param string $http_version The protocol version, e.g. "1.1", optionally prefixed by "HTTP/".
1241 * @throws \http\Exception\InvalidArgumentException
1242 * @throws \http\Exception\BadHeaderException
1243 * @return \http\Message self.
1244 */
1245 function setHttpVersion(string $http_version) {}
1246 /**
1247 * Set the complete message info, i.e. type and response resp. request information, at once.
1248 * See http\Message::getInfo().
1249 *
1250 * @param string $http_info The message info (first line of an HTTP message).
1251 * @throws \http\Exception\InvalidArgumentException
1252 * @throws \http\Exception\BadHeaderException
1253 * @return \http\Message self.
1254 */
1255 function setInfo(string $http_info) {}
1256 /**
1257 * Set the request method of the message.
1258 * See http\Message::getRequestMethod() and http\Message::setRequestUrl().
1259 *
1260 * @param string $method The request method.
1261 * @throws \http\Exception\InvalidArgumentException
1262 * @throws \http\Exception\BadMethodCallException
1263 * @return \http\Message self.
1264 */
1265 function setRequestMethod(string $method) {}
1266 /**
1267 * Set the request URL of the message.
1268 * See http\Message::getRequestUrl() and http\Message::setRequestMethod().
1269 *
1270 * @param string $url The request URL.
1271 * @throws \http\Exception\InvalidArgumentException
1272 * @throws \http\Exception\BadMethodCallException
1273 * @return \http\Message self.
1274 */
1275 function setRequestUrl(string $url) {}
1276 /**
1277 * Set the response status code.
1278 * See http\Message::getResponseCode() and http\Message::setResponseStatus().
1279 *
1280 * > ***NOTE:***
1281 * > This method also resets the response status phrase to the default for that code.
1282 *
1283 * @param int $response_code The response code.
1284 * @param bool $strict Whether to check that the response code is between 100 and 599 inclusive.
1285 * @throws \http\Exception\InvalidArgumentException
1286 * @throws \http\Exception\BadMethodCallException
1287 * @return \http\Message self.
1288 */
1289 function setResponseCode(int $response_code, bool $strict = true) {}
1290 /**
1291 * Set the response status phrase.
1292 * See http\Message::getResponseStatus() and http\Message::setResponseCode().
1293 *
1294 * @param string $response_status The status phrase.
1295 * @throws \http\Exception\InvalidArgumentException
1296 * @throws \http\Exception\BadMethodCallException
1297 * @return \http\Message self.
1298 */
1299 function setResponseStatus(string $response_status) {}
1300 /**
1301 * Set the message type and reset the message info.
1302 * See http\Message::getType() and http\Message::setInfo().
1303 *
1304 * @param int $type The desired message type. See the http\Message::TYPE_* constants.
1305 * @return \http\Message self.
1306 */
1307 function setType(int $type) {}
1308 /**
1309 * Splits the body of a multipart message.
1310 * See http\Message::isMultipart() and http\Message\Body::addPart().
1311 *
1312 * @throws \http\Exception\InvalidArgumentException
1313 * @throws \http\Exception\BadMethodCallException
1314 * @throws \http\Exception\BadMessageException
1315 * @return \http\Message a message chain of all messages of the multipart body.
1316 */
1317 function splitMultipartBody() {}
1318 /**
1319 * Stream the message through a callback.
1320 *
1321 * @param callable $callback The callback of the form function(http\Message $from, string $data).
1322 * @return \http\Message self.
1323 */
1324 function toCallback(callable $callback) {}
1325 /**
1326 * Stream the message into stream $stream, starting from $offset, streaming $maxlen at most.
1327 *
1328 * @param resource $stream The resource to write to.
1329 * @return \http\Message self.
1330 */
1331 function toStream($stream) {}
1332 /**
1333 * Retrieve the message serialized to a string.
1334 *
1335 * @param bool $include_parent Whether to include all parent messages.
1336 * @return string the HTTP message chain serialized to a string.
1337 */
1338 function toString(bool $include_parent = false) {}
1339 /**
1340 * Implements Serializable.
1341 *
1342 * @param string $data The serialized message.
1343 */
1344 function unserialize($data) {}
1345 /**
1346 * Implements Iterator.
1347 * See http\Message::current() and http\Message::rewind().
1348 *
1349 * @return bool whether http\Message::current() would not return NULL.
1350 */
1351 function valid() {}
1352 }
1353 /**
1354 * Parse, interpret and compose HTTP (header) parameters.
1355 */
1356 class Params implements \ArrayAccess {
1357 /**
1358 * The default parameter separator (",").
1359 */
1360 const DEF_PARAM_SEP = ',';
1361 /**
1362 * The default argument separator (";").
1363 */
1364 const DEF_ARG_SEP = ';';
1365 /**
1366 * The default value separator ("=").
1367 */
1368 const DEF_VAL_SEP = '=';
1369 /**
1370 * Empty param separator to parse cookies.
1371 */
1372 const COOKIE_PARAM_SEP = '';
1373 /**
1374 * Do not interpret the parsed parameters.
1375 */
1376 const PARSE_RAW = 0;
1377 /**
1378 * Interpret input as default formatted parameters.
1379 */
1380 const PARSE_DEFAULT = 17;
1381 /**
1382 * Parse backslash escaped (quoted) strings.
1383 */
1384 const PARSE_ESCAPED = 1;
1385 /**
1386 * Urldecode single units of parameters, arguments and values.
1387 */
1388 const PARSE_URLENCODED = 4;
1389 /**
1390 * Parse sub dimensions indicated by square brackets.
1391 */
1392 const PARSE_DIMENSION = 8;
1393 /**
1394 * Parse URL querystring (same as http\Params::PARSE_URLENCODED|http\Params::PARSE_DIMENSION).
1395 */
1396 const PARSE_QUERY = 12;
1397 /**
1398 * Parse [RFC5987](http://tools.ietf.org/html/rfc5987) style encoded character set and language information embedded in HTTP header params.
1399 */
1400 const PARSE_RFC5987 = 16;
1401 /**
1402 * Parse [RFC5988](http://tools.ietf.org/html/rfc5988) (Web Linking) tags of Link headers.
1403 */
1404 const PARSE_RFC5988 = 32;
1405 /**
1406 * The (parsed) parameters.
1407 *
1408 * @public
1409 * @var array
1410 */
1411 public $params = NULL;
1412 /**
1413 * The parameter separator(s).
1414 *
1415 * @public
1416 * @var array
1417 */
1418 public $param_sep = \http\Params::DEF_PARAM_SEP;
1419 /**
1420 * The argument separator(s).
1421 *
1422 * @public
1423 * @var array
1424 */
1425 public $arg_sep = \http\Params::DEF_ARG_SEP;
1426 /**
1427 * The value separator(s).
1428 *
1429 * @public
1430 * @var array
1431 */
1432 public $val_sep = \http\Params::DEF_VAL_SEP;
1433 /**
1434 * The modus operandi of the parser. See http\Params::PARSE_* constants.
1435 *
1436 * @public
1437 * @var int
1438 */
1439 public $flags = \http\Params::PARSE_DEFAULT;
1440 /**
1441 * Instantiate a new HTTP (header) parameter set.
1442 *
1443 * @param mixed $params Pre-parsed parameters or a string to be parsed.
1444 * @param mixed $ps The parameter separator(s).
1445 * @param mixed $as The argument separator(s).
1446 * @param mixed $vs The value separator(s).
1447 * @param int $flags The modus operandi. See http\Params::PARSE_* constants.
1448 * @throws \http\Exception\InvalidArgumentException
1449 * @throws \http\Exception\RuntimeException
1450 */
1451 function __construct($params = NULL, $ps = NULL, $as = NULL, $vs = NULL, int $flags = NULL) {}
1452 /**
1453 * String cast handler. Alias of http\Params::toString().
1454 * Returns a stringified version of the parameters.
1455 *
1456 * @return string version of the parameters.
1457 */
1458 function __toString() {}
1459 /**
1460 * Implements ArrayAccess.
1461 *
1462 * @param string $name The offset to look after.
1463 * @return bool Existence.
1464 */
1465 function offsetExists($name) {}
1466 /**
1467 * Implements ArrayAccess.
1468 *
1469 * @param string $name The offset to retrieve.
1470 * @return mixed contents at offset.
1471 */
1472 function offsetGet($name) {}
1473 /**
1474 * Implements ArrayAccess.
1475 *
1476 * @param string $name The offset to modify.
1477 * @param mixed $value The value to set.
1478 */
1479 function offsetSet($name, $value) {}
1480 /**
1481 * Implements ArrayAccess.
1482 *
1483 * @param string $name The offset to delete.
1484 */
1485 function offsetUnset($name) {}
1486 /**
1487 * Convenience method that simply returns http\Params::$params.
1488 *
1489 * @return array of parameters.
1490 */
1491 function toArray() {}
1492 /**
1493 * Returns a stringified version of the parameters.
1494 *
1495 * @return string version of the parameters.
1496 */
1497 function toString() {}
1498 }
1499 /**
1500 * The http\QueryString class provides versatile facilities to retrieve, use and manipulate query strings and form data.
1501 */
1502 class QueryString implements \Serializable, \ArrayAccess, \IteratorAggregate {
1503 /**
1504 * Cast requested value to bool.
1505 */
1506 const TYPE_BOOL = 17;
1507 /**
1508 * Cast requested value to int.
1509 */
1510 const TYPE_INT = 4;
1511 /**
1512 * Cast requested value to float.
1513 */
1514 const TYPE_FLOAT = 5;
1515 /**
1516 * Cast requested value to string.
1517 */
1518 const TYPE_STRING = 6;
1519 /**
1520 * Cast requested value to an array.
1521 */
1522 const TYPE_ARRAY = 7;
1523 /**
1524 * Cast requested value to an object.
1525 */
1526 const TYPE_OBJECT = 8;
1527 /**
1528 * The global instance. See http\QueryString::getGlobalInstance().
1529 *
1530 * @private
1531 * @var \http\QueryString
1532 */
1533 private $instance = NULL;
1534 /**
1535 * The data.
1536 *
1537 * @private
1538 * @var array
1539 */
1540 private $queryArray = NULL;
1541 /**
1542 * Create an independent querystring instance.
1543 *
1544 * @param mixed $params The query parameters to use or parse.
1545 * @throws \http\Exception\BadQueryStringException
1546 */
1547 function __construct($params = NULL) {}
1548 /**
1549 * Get the string representation of the querystring (x-www-form-urlencoded).
1550 *
1551 * @return string the x-www-form-urlencoded querystring.
1552 */
1553 function __toString() {}
1554 /**
1555 * Retrieve an querystring value.
1556 *
1557 * See http\QueryString::TYPE_* constants.
1558 *
1559 * @param string $name The key to retrieve the value for.
1560 * @param mixed $type The type to cast the value to. See http\QueryString::TYPE_* constants.
1561 * @param mixed $defval The default value to return if the key $name does not exist.
1562 * @param bool $delete Whether to delete the entry from the querystring after retrieval.
1563 * @return \http\QueryString|string|mixed|mixed|string \http\QueryString if called without arguments.
1564 * or string the whole querystring if $name is of zero length.
1565 * or mixed $defval if the key $name does not exist.
1566 * or mixed the querystring value cast to $type if $type was specified and the key $name exists.
1567 * or string the querystring value if the key $name exists and $type is not specified or equals http\QueryString::TYPE_STRING.
1568 */
1569 function get(string $name = NULL, $type = NULL, $defval = NULL, bool $delete = false) {}
1570 /**
1571 * Retrieve an array value with at offset $name.
1572 *
1573 * @param string $name The key to look up.
1574 * @param mixed $defval The default value to return if the offset $name does not exist.
1575 * @param bool $delete Whether to remove the key and value from the querystring after retrieval.
1576 * @return array|mixed array the (casted) value.
1577 * or mixed $defval if offset $name does not exist.
1578 */
1579 function getArray(string $name, $defval = NULL, bool $delete = false) {}
1580 /**
1581 * Retrieve a boolean value at offset $name.
1582 *
1583 * @param string $name The key to look up.
1584 * @param mixed $defval The default value to return if the offset $name does not exist.
1585 * @param bool $delete Whether to remove the key and value from the querystring after retrieval.
1586 * @return bool|mixed bool the (casted) value.
1587 * or mixed $defval if offset $name does not exist.
1588 */
1589 function getBool(string $name, $defval = NULL, bool $delete = false) {}
1590 /**
1591 * Retrieve a float value at offset $name.
1592 *
1593 * @param string $name The key to look up.
1594 * @param mixed $defval The default value to return if the offset $name does not exist.
1595 * @param bool $delete Whether to remove the key and value from the querystring after retrieval.
1596 * @return float|mixed float the (casted) value.
1597 * or mixed $defval if offset $name does not exist.
1598 */
1599 function getFloat(string $name, $defval = NULL, bool $delete = false) {}
1600 /**
1601 * Retrieve the global querystring instance referencing $_GET.
1602 *
1603 * @throws \http\Exception\UnexpectedValueException
1604 * @return \http\QueryString the http\QueryString::$instance
1605 */
1606 function getGlobalInstance() {}
1607 /**
1608 * Retrieve a int value at offset $name.
1609 *
1610 * @param string $name The key to look up.
1611 * @param mixed $defval The default value to return if the offset $name does not exist.
1612 * @param bool $delete Whether to remove the key and value from the querystring after retrieval.
1613 * @return int|mixed int the (casted) value.
1614 * or mixed $defval if offset $name does not exist.
1615 */
1616 function getInt(string $name, $defval = NULL, bool $delete = false) {}
1617 /**
1618 * Implements IteratorAggregate.
1619 *
1620 * @throws \http\Exception\InvalidArgumentException
1621 * @throws \InvalidArgumentException
1622 */
1623 function getIterator() {}
1624 /**
1625 * Retrieve a object value with at offset $name.
1626 *
1627 * @param string $name The key to look up.
1628 * @param mixed $defval The default value to return if the offset $name does not exist.
1629 * @param bool $delete Whether to remove the key and value from the querystring after retrieval.
1630 * @return object|mixed object the (casted) value.
1631 * or mixed $defval if offset $name does not exist.
1632 */
1633 function getObject(string $name, $defval = NULL, bool $delete = false) {}
1634 /**
1635 * Retrieve a string value with at offset $name.
1636 *
1637 * @param string $name The key to look up.
1638 * @param mixed $defval The default value to return if the offset $name does not exist.
1639 * @param bool $delete Whether to remove the key and value from the querystring after retrieval.
1640 * @return string|mixed string the (casted) value.
1641 * or mixed $defval if offset $name does not exist.
1642 */
1643 function getString(string $name, $defval = NULL, bool $delete = false) {}
1644 /**
1645 * Set additional $params to a clone of this instance.
1646 * See http\QueryString::set().
1647 *
1648 * > ***NOTE:***
1649 * > This method returns a clone (copy) of this instance.
1650 *
1651 * @param mixed $params Additional params as object, array or string to parse.
1652 * @throws \http\Exception\BadQueryStringException
1653 * @return \http\QueryString clone.
1654 */
1655 function mod($params = NULL) {}
1656 /**
1657 * Implements ArrayAccess.
1658 *
1659 * @param string $name The offset to look up.
1660 * @return bool whether the key $name isset.
1661 */
1662 function offsetExists($name) {}
1663 /**
1664 * Implements ArrayAccess.
1665 *
1666 * @param mixed $offset The offset to look up.
1667 * @return mixed|NULL mixed the value locate at offset $name.
1668 * or NULL if key $name could not be found.
1669 */
1670 function offsetGet($offset) {}
1671 /**
1672 * Implements ArrayAccess.
1673 *
1674 * @param string $name The key to set the value for.
1675 * @param mixed $data The data to place at offset $name.
1676 */
1677 function offsetSet($name, $data) {}
1678 /**
1679 * Implements ArrayAccess.
1680 *
1681 * @param string $name The offset to look up.
1682 */
1683 function offsetUnset($name) {}
1684 /**
1685 * Implements Serializable.
1686 * See http\QueryString::toString().
1687 *
1688 * @return string the x-www-form-urlencoded querystring.
1689 */
1690 function serialize() {}
1691 /**
1692 * Set additional querystring entries.
1693 *
1694 * @param mixed $params Additional params as object, array or string to parse.
1695 * @return \http\QueryString self.
1696 */
1697 function set($params) {}
1698 /**
1699 * Simply returns http\QueryString::$queryArray.
1700 *
1701 * @return array the $queryArray property.
1702 */
1703 function toArray() {}
1704 /**
1705 * Get the string representation of the querystring (x-www-form-urlencoded).
1706 *
1707 * @return string the x-www-form-urlencoded querystring.
1708 */
1709 function toString() {}
1710 /**
1711 * Implements Serializable.
1712 *
1713 * @param string $serialized The x-www-form-urlencoded querystring.
1714 * @throws \http\Exception
1715 */
1716 function unserialize($serialized) {}
1717 /**
1718 * Translate character encodings of the querystring with ext/iconv.
1719 *
1720 * > ***NOTE:***
1721 * > This method is only available when ext/iconv support was enabled at build time.
1722 *
1723 * @param string $from_enc The encoding to convert from.
1724 * @param string $to_enc The encoding to convert to.
1725 * @throws \http\Exception\InvalidArgumentException
1726 * @throws \http\Exception\BadConversionException
1727 * @return \http\QueryString self.
1728 */
1729 function xlate(string $from_enc, string $to_enc) {}
1730 }
1731 /**
1732 * The http\Url class provides versatile means to parse, construct and manipulate URLs.
1733 */
1734 class Url {
1735 /**
1736 * Replace parts of the old URL with parts of the new.
1737 */
1738 const REPLACE = 0;
1739 /**
1740 * Whether a relative path should be joined into the old path.
1741 */
1742 const JOIN_PATH = 1;
1743 /**
1744 * Whether the querystrings should be joined.
1745 */
1746 const JOIN_QUERY = 2;
1747 /**
1748 * Strip the user information from the URL.
1749 */
1750 const STRIP_USER = 4;
1751 /**
1752 * Strip the password from the URL.
1753 */
1754 const STRIP_PASS = 8;
1755 /**
1756 * Strip user and password information from URL (same as STRIP_USER|STRIP_PASS).
1757 */
1758 const STRIP_AUTH = 12;
1759 /**
1760 * Do not include the port.
1761 */
1762 const STRIP_PORT = 32;
1763 /**
1764 * Do not include the URL path.
1765 */
1766 const STRIP_PATH = 64;
1767 /**
1768 * Do not include the URL querystring.
1769 */
1770 const STRIP_QUERY = 128;
1771 /**
1772 * Strip the fragment (hash) from the URL.
1773 */
1774 const STRIP_FRAGMENT = 256;
1775 /**
1776 * Strip everything except scheme and host information.
1777 */
1778 const STRIP_ALL = 492;
1779 /**
1780 * Import initial URL parts from the SAPI environment.
1781 */
1782 const FROM_ENV = 4096;
1783 /**
1784 * Whether to sanitize the URL path (consolidate double slashes, directory jumps etc.)
1785 */
1786 const SANITIZE_PATH = 8192;
1787 /**
1788 * Parse UTF-8 encoded multibyte sequences.
1789 */
1790 const PARSE_MBUTF8 = 131072;
1791 /**
1792 * Parse locale encoded multibyte sequences (on systems with wide character support).
1793 */
1794 const PARSE_MBLOC = 65536;
1795 /**
1796 * Parse and convert multibyte hostnames according to IDNA (with IDNA support).
1797 */
1798 const PARSE_TOIDN = 1048576;
1799 /**
1800 * Explicitly request IDNA2003 implementation if available (libidn, idnkit or ICU).
1801 */
1802 const PARSE_TOIDN_2003 = 9437184;
1803 /**
1804 * Explicitly request IDNA2008 implementation if available (libidn2, idnkit2 or ICU).
1805 */
1806 const PARSE_TOIDN_2008 = 5242880;
1807 /**
1808 * Percent encode multibyte sequences in the userinfo, path, query and fragment parts of the URL.
1809 */
1810 const PARSE_TOPCT = 2097152;
1811 /**
1812 * Continue parsing when encountering errors.
1813 */
1814 const IGNORE_ERRORS = 268435456;
1815 /**
1816 * Suppress errors/exceptions.
1817 */
1818 const SILENT_ERRORS = 536870912;
1819 /**
1820 * Standard flags used by default internally for e.g. http\Message::setRequestUrl().
1821 * Enables joining path and query, sanitizing path, multibyte/unicode, international domain names and transient percent encoding.
1822 */
1823 const STDFLAGS = 3350531;
1824 /**
1825 * The URL's scheme.
1826 *
1827 * @public
1828 * @var string
1829 */
1830 public $scheme = NULL;
1831 /**
1832 * Authenticating user.
1833 *
1834 * @public
1835 * @var string
1836 */
1837 public $user = NULL;
1838 /**
1839 * Authentication password.
1840 *
1841 * @public
1842 * @var string
1843 */
1844 public $pass = NULL;
1845 /**
1846 * Hostname/domain.
1847 *
1848 * @public
1849 * @var string
1850 */
1851 public $host = NULL;
1852 /**
1853 * Port.
1854 *
1855 * @public
1856 * @var string
1857 */
1858 public $port = NULL;
1859 /**
1860 * URL path.
1861 *
1862 * @public
1863 * @var string
1864 */
1865 public $path = NULL;
1866 /**
1867 * URL querystring.
1868 *
1869 * @public
1870 * @var string
1871 */
1872 public $query = NULL;
1873 /**
1874 * URL fragment (hash).
1875 *
1876 * @public
1877 * @var string
1878 */
1879 public $fragment = NULL;
1880 /**
1881 * Create an instance of an http\Url.
1882 *
1883 * > ***NOTE:***
1884 * > Prior to v3.0.0, the default for the $flags parameter was http\Url::FROM_ENV.
1885 *
1886 * See also http\Env\Url.
1887 *
1888 * @param mixed $old_url Initial URL parts. Either an array, object, http\Url instance or string to parse.
1889 * @param mixed $new_url Overriding URL parts. Either an array, object, http\Url instance or string to parse.
1890 * @param int $flags The modus operandi of constructing the url. See http\Url constants.
1891 * @throws \http\Exception\InvalidArgumentException
1892 * @throws \http\Exception\BadUrlException
1893 */
1894 function __construct($old_url = NULL, $new_url = NULL, int $flags = 0) {}
1895 /**
1896 * String cast handler. Alias of http\Url::toString().
1897 *
1898 * @return string the URL as string.
1899 */
1900 function __toString() {}
1901 /**
1902 * Clone this URL and apply $parts to the cloned URL.
1903 *
1904 * > ***NOTE:***
1905 * > This method returns a clone (copy) of this instance.
1906 *
1907 * @param mixed $parts New URL parts.
1908 * @param int $flags Modus operandi of URL construction. See http\Url constants.
1909 * @throws \http\Exception\InvalidArgumentException
1910 * @throws \http\Exception\BadUrlException
1911 * @return \http\Url clone.
1912 */
1913 function mod($parts, int $flags = \http\Url::JOIN_PATH|http\Url::JOIN_QUERY|http\Url::SANITIZE_PATH) {}
1914 /**
1915 * Retrieve the URL parts as array.
1916 *
1917 * @return array the URL parts.
1918 */
1919 function toArray() {}
1920 /**
1921 * Get the string prepresentation of the URL.
1922 *
1923 * @return string the URL as string.
1924 */
1925 function toString() {}
1926 }
1927 /**
1928 * The http\Client\Curl namespace holds option value constants specific to the curl driver of the http\Client.
1929 *
1930 * Head down for the [list of available request options](http/Client/Curl#Options:) as well as the
1931 * [list of available client configuration options](http/Client/Curl#Configuration:).
1932 */
1933 namespace http\Client\Curl;
1934 /**
1935 * Bitmask of available libcurl features.
1936 * See http\Client\Curl\Features namespace.
1937 */
1938 const FEATURES = 12568477;
1939 /**
1940 * List of library versions of or linked into libcurl,
1941 * e.g. "libcurl/7.50.0 OpenSSL/1.0.2h zlib/1.2.8 libidn/1.32 nghttp2/1.12.0".
1942 * See http\Client\Curl\Versions namespace.
1943 */
1944 const VERSIONS = 'libcurl/7.68.0 OpenSSL/1.1.1f zlib/1.2.11 brotli/1.0.7 libidn2/2.2.0 libpsl/0.21.0 (+libidn2/2.2.0) libssh/0.9.3/openssl/zlib nghttp2/1.40.0 librtmp/2.3';
1945 /**
1946 * Use HTTP/1.0 protocol version.
1947 */
1948 const HTTP_VERSION_1_0 = 1;
1949 /**
1950 * Use HTTP/1.1 protocol version.
1951 */
1952 const HTTP_VERSION_1_1 = 2;
1953 /**
1954 * Attempt to use HTTP/2 protocol version. Available if libcurl is v7.33.0 or more recent and was built with nghttp2 support.
1955 */
1956 const HTTP_VERSION_2_0 = 3;
1957 /**
1958 * Attempt to use version 2 for HTTPS, version 1.1 for HTTP. Available if libcurl is v7.47.0 or more recent and was built with http2 support.
1959 */
1960 const HTTP_VERSION_2TLS = 4;
1961 /**
1962 * Declare prior knowledge that the server supports plain (non-TLS) HTTP/2. Available if libcurl is v7.49.0 or more recent and was built with http2 support.
1963 */
1964 const HTTP_VERSION_2_PRIOR_KNOWLEDGE = 5;
1965 /**
1966 * Force usage of HTTP/3. See also http\Client\Curl::$altsvc. Available if libcurl is v7.66.0 or more recent.
1967 */
1968 const HTTP_VERSION_3 = 30;
1969 /**
1970 * Use any HTTP protocol version.
1971 */
1972 const HTTP_VERSION_ANY = 0;
1973 /**
1974 * Use TLS v1.0 encryption. Available if libcurl is v7.34.0 or more recent.
1975 */
1976 const SSL_VERSION_TLSv1_0 = 4;
1977 /**
1978 * Use TLS v1.1 encryption. Available if libcurl is v7.34.0 or more recent.
1979 */
1980 const SSL_VERSION_TLSv1_1 = 5;
1981 /**
1982 * Use TLS v1.2 encryption. Available if libcurl is v7.34.0 or more recent.
1983 */
1984 const SSL_VERSION_TLSv1_2 = 6;
1985 /**
1986 * Use TLS v1.3 encryption. Available if libcurl is v7.52.0 or more recent.
1987 */
1988 const SSL_VERSION_TLSv1_3 = 7;
1989 /**
1990 * Use any TLS v1 encryption.
1991 */
1992 const SSL_VERSION_TLSv1 = 1;
1993 /**
1994 * Use SSL v2 encryption.
1995 */
1996 const SSL_VERSION_SSLv2 = 2;
1997 /**
1998 * Use SSL v3 encryption.
1999 */
2000 const SSL_VERSION_SSLv3 = 3;
2001 /**
2002 * Use any encryption.
2003 */
2004 const SSL_VERSION_ANY = 0;
2005 /**
2006 * Use max default encryption. To be bitwise ORed to a http\Client\Curl\SSL_VERSION_ constant. Available if libcurl is v7.54.0 or more recent.
2007 */
2008 const SSL_VERSION_MAX_DEFAULT = 65536;
2009 /**
2010 * Use upt to TLS v1.0 encryption. To be bitwise ORed to a http\Client\Curl\SSL_VERSION_ constant. Available if libcurl is v7.54.0 or more recent.
2011 */
2012 const SSL_VERSION_MAX_TLSv1_0 = 262144;
2013 /**
2014 * Use up to TLS v1.1 encryption. To be bitwise ORed to a http\Client\Curl\SSL_VERSION_ constant. Available if libcurl is v7.54.0 or more recent.
2015 */
2016 const SSL_VERSION_MAX_TLSv1_1 = 327680;
2017 /**
2018 * Use up to TLS v1.2 encryption. To be bitwise ORed to a http\Client\Curl\SSL_VERSION_ constant. Available if libcurl is v7.54.0 or more recent.
2019 */
2020 const SSL_VERSION_MAX_TLSv1_2 = 393216;
2021 /**
2022 * Use up to TLS v1.3 encryption. To be bitwise ORed to a http\Client\Curl\SSL_VERSION_ constant. Available if libcurl is v7.54.0 or more recent.
2023 */
2024 const SSL_VERSION_MAX_TLSv1_3 = 458752;
2025 /**
2026 * Use TLS SRP authentication. Available if libcurl is v7.21.4 or more recent and was built with gnutls or openssl with TLS-SRP support.
2027 */
2028 const TLSAUTH_SRP = 1;
2029 /**
2030 * Use IPv4 resolver.
2031 */
2032 const IPRESOLVE_V4 = 1;
2033 /**
2034 * Use IPv6 resolver.
2035 */
2036 const IPRESOLVE_V6 = 2;
2037 /**
2038 * Use any resolver.
2039 */
2040 const IPRESOLVE_ANY = 0;
2041 /**
2042 * Don't use authentication.
2043 */
2044 const AUTH_NONE = 0;
2045 /**
2046 * Use Basic authentication.
2047 */
2048 const AUTH_BASIC = 1;
2049 /**
2050 * Use Digest authentication.
2051 */
2052 const AUTH_DIGEST = 2;
2053 /**
2054 * Use IE (lower v7) quirks with Digest authentication. Available if libcurl is v7.19.3 or more recent.
2055 */
2056 const AUTH_DIGEST_IE = 16;
2057 /**
2058 * Use NTLM authentication.
2059 */
2060 const AUTH_NTLM = 8;
2061 /**
2062 * Use GSS-Negotiate authentication.
2063 */
2064 const AUTH_GSSNEG = 4;
2065 /**
2066 * Use HTTP Netgotiate authentication (SPNEGO, RFC4559). Available if libcurl is v7.38.0 or more recent.
2067 */
2068 const AUTH_SPNEGO = 4;
2069 /**
2070 * Bearer authentication. Set bearer with http\Client\Curl::$xoauth2_bearer request option. Available if libcurl is v7.61.0 or more recent.
2071 */
2072 const AUTH_BEARER = 64;
2073 /**
2074 * Use AWS SIGv4 authentication. Available if libcurl is v7.75.0 or more recent.
2075 */
2076 const AUTH_AWS_SIGV4 = NULL;
2077 /**
2078 * Use any authentication.
2079 */
2080 const AUTH_ANY = -17;
2081 /**
2082 * Use SOCKSv4 proxy protocol.
2083 */
2084 const PROXY_SOCKS4 = 4;
2085 /**
2086 * Use SOCKSv4a proxy protocol.
2087 */
2088 const PROXY_SOCKS4A = 6;
2089 /**
2090 * Use SOCKS5h proxy protocol.
2091 */
2092 const PROXY_SOCKS5_HOSTNAME = 7;
2093 /**
2094 * Use SOCKS5 proxy protoccol.
2095 */
2096 const PROXY_SOCKS5 = 5;
2097 /**
2098 * Use HTTP/1.1 proxy protocol.
2099 */
2100 const PROXY_HTTP = 0;
2101 /**
2102 * Use HTTP/1.0 proxy protocol. Available if libcurl is v7.19.4 or more recent.
2103 */
2104 const PROXY_HTTP_1_0 = 1;
2105 /**
2106 * Keep POSTing on 301 redirects. Available if libcurl is v7.19.1 or more recent.
2107 */
2108 const POSTREDIR_301 = 1;
2109 /**
2110 * Keep POSTing on 302 redirects. Available if libcurl is v7.19.1 or more recent.
2111 */
2112 const POSTREDIR_302 = 2;
2113 /**
2114 * Keep POSTing on 303 redirects. Available if libcurl is v7.19.1 or more recent.
2115 */
2116 const POSTREDIR_303 = 4;
2117 /**
2118 * Keep POSTing on any redirect. Available if libcurl is v7.19.1 or more recent.
2119 */
2120 const POSTREDIR_ALL = 7;
2121 /**
2122 * Do only read from but not write to the Alt-Svc cache file. Available if libcurl is v7.64.1 or more recent.
2123 */
2124 const ALTSVC_READONLYFILE = 4;
2125 /**
2126 * Accept alternative services offered over HTTP/1.1. Available if libcurl is v7.64.1 or more recent.
2127 */
2128 const ALTSVC_H1 = 8;
2129 /**
2130 * Accept alternative services offered over HTTP/2. Available if libcurl is v7.64.1 or more recent.
2131 */
2132 const ALTSVC_H2 = 16;
2133 /**
2134 * Accept alternative services offered over HTTP/3. Available if libcurl is v7.64.1 or more recent.
2135 */
2136 const ALTSVC_H3 = 32;
2137 /**
2138 * Enable the cache. Available if libcurl is v7.74.0 or more recent.
2139 */
2140 const HSTS_ENABLE = NULL;
2141 /**
2142 * Do only read from but not write to the HSTS cache file. Available if libcurl is v7.74.0 or more recent.
2143 */
2144 const HSTS_READONLYFILE = NULL;
2145 namespace http\Client;
2146 /**
2147 * The http\Client\Request class provides an HTTP message implementation tailored to represent a request message to be sent by the client.
2148 *
2149 * See http\Client::enqueue().
2150 */
2151 class Request extends \http\Message {
2152 /**
2153 * Array of options for this request, which override client options.
2154 *
2155 * @protected
2156 * @var array
2157 */
2158 protected $options = NULL;
2159 /**
2160 * Create a new client request message to be enqueued and sent by http\Client.
2161 *
2162 * @param string $meth The request method.
2163 * @param string $url The request URL.
2164 * @param array $headers HTTP headers.
2165 * @param \http\Message\Body $body Request body.
2166 * @throws \http\Exception\InvalidArgumentException
2167 * @throws \http\Exception\UnexpectedValueException
2168 */
2169 function __construct(string $meth = NULL, string $url = NULL, array $headers = NULL, \http\Message\Body $body = NULL) {}
2170 /**
2171 * Add querystring data.
2172 * See http\Client\Request::setQuery() and http\Message::setRequestUrl().
2173 *
2174 * @param mixed $query_data Additional querystring data.
2175 * @throws \http\Exception\InvalidArgumentException
2176 * @throws \http\Exception\BadQueryStringException
2177 * @return \http\Client\Request self.
2178 */
2179 function addQuery($query_data) {}
2180 /**
2181 * Add specific SSL options.
2182 * See http\Client\Request::setSslOptions(), http\Client\Request::setOptions() and http\Client\Curl\$ssl options.
2183 *
2184 * @param array $ssl_options Add this SSL options.
2185 * @throws \http\Exception\InvalidArgumentException
2186 * @return \http\Client\Request self.
2187 */
2188 function addSslOptions(array $ssl_options = NULL) {}
2189 /**
2190 * Extract the currently set "Content-Type" header.
2191 * See http\Client\Request::setContentType().
2192 *
2193 * @return string|NULL string the currently set content type.
2194 * or NULL if no "Content-Type" header is set.
2195 */
2196 function getContentType() {}
2197 /**
2198 * Get priorly set options.
2199 * See http\Client\Request::setOptions().
2200 *
2201 * @return array options.
2202 */
2203 function getOptions() {}
2204 /**
2205 * Retrieve the currently set querystring.
2206 *
2207 * @return string|NULL string the currently set querystring.
2208 * or NULL if no querystring is set.
2209 */
2210 function getQuery() {}
2211 /**
2212 * Retrieve priorly set SSL options.
2213 * See http\Client\Request::getOptions() and http\Client\Request::setSslOptions().
2214 *
2215 * @return array SSL options.
2216 */
2217 function getSslOptions() {}
2218 /**
2219 * Set the MIME content type of the request message.
2220 *
2221 * @param string $content_type The MIME type used as "Content-Type".
2222 * @throws \http\Exception\InvalidArgumentException
2223 * @throws \http\Exception\UnexpectedValueException
2224 * @return \http\Client\Request self.
2225 */
2226 function setContentType(string $content_type) {}
2227 /**
2228 * Set client options.
2229 * See http\Client::setOptions() and http\Client\Curl.
2230 *
2231 * Request specific options override general options which were set in the client.
2232 *
2233 * > ***NOTE:***
2234 * > Only options specified prior enqueueing a request are applied to the request.
2235 *
2236 * @param array $options The options to set.
2237 * @throws \http\Exception\InvalidArgumentException
2238 * @return \http\Client\Request self.
2239 */
2240 function setOptions(array $options = NULL) {}
2241 /**
2242 * (Re)set the querystring.
2243 * See http\Client\Request::addQuery() and http\Message::setRequestUrl().
2244 *
2245 * @param mixed $query_data
2246 * @throws \http\Exception\InvalidArgumentException
2247 * @throws \http\Exception\BadQueryStringException
2248 * @return \http\Client\Request self.
2249 */
2250 function setQuery($query_data) {}
2251 /**
2252 * Specifically set SSL options.
2253 * See http\Client\Request::setOptions() and http\Client\Curl\$ssl options.
2254 *
2255 * @param array $ssl_options Set SSL options to this array.
2256 * @throws \http\Exception\InvalidArgumentException
2257 * @return \http\Client\Request self.
2258 */
2259 function setSslOptions(array $ssl_options = NULL) {}
2260 }
2261 /**
2262 * The http\Client\Response class represents an HTTP message the client returns as answer from a server to an http\Client\Request.
2263 */
2264 class Response extends \http\Message {
2265 /**
2266 * Extract response cookies.
2267 * Parses any "Set-Cookie" response headers into an http\Cookie list. See http\Cookie::__construct().
2268 *
2269 * @param int $flags Cookie parser flags.
2270 * @param array $allowed_extras List of keys treated as extras.
2271 * @return array list of http\Cookie instances.
2272 */
2273 function getCookies(int $flags = 0, array $allowed_extras = NULL) {}
2274 /**
2275 * Retrieve transfer related information after the request has completed.
2276 * See http\Client::getTransferInfo().
2277 *
2278 * @param string $name A key to retrieve out of the transfer info.
2279 * @throws \http\Exception\InvalidArgumentException
2280 * @throws \http\Exception\BadMethodCallException
2281 * @throws \http\Exception\UnexpectedValueException
2282 * @return object|mixed object stdClass instance with all transfer info if $name was not given.
2283 * or mixed the specific transfer info for $name.
2284 */
2285 function getTransferInfo(string $name = NULL) {}
2286 }
2287 namespace http\Client\Curl;
2288 /**
2289 * Interface to an user event loop implementation for http\Client::configure()'s $use_eventloop option.
2290 *
2291 * > ***NOTE:***
2292 * > This interface was added in v2.6.0, resp. v3.1.0.
2293 */
2294 interface User {
2295 /**
2296 * No action.
2297 */
2298 const POLL_NONE = 0;
2299 /**
2300 * Poll for read readiness.
2301 */
2302 const POLL_IN = 1;
2303 /**
2304 * Poll for write readiness.
2305 */
2306 const POLL_OUT = 2;
2307 /**
2308 * Poll for read/write readiness.
2309 */
2310 const POLL_INOUT = 3;
2311 /**
2312 * Stop polling for activity on this descriptor.
2313 */
2314 const POLL_REMOVE = 4;
2315 /**
2316 * Initialize the event loop.
2317 *
2318 * @param callable $run as function(http\Client $c, resource $s = null, int $action = http\Client\Curl\User::POLL_NONE) : int
2319 * Internal callback returning the number of unfinished requests pending.
2320 *
2321 *
2322 * > ***NOTE***:
2323 * > The callback should be run when a timeout occurs or a watched socket needs action.
2324 */
2325 function init(callable $run);
2326 /**
2327 * Run the loop as long as it does not block.
2328 *
2329 * > ***NOTE:***
2330 * > This method is called by http\Client::once(), so it does not need to have an actual implementation if http\Client::once() is never called.
2331 */
2332 function once();
2333 /**
2334 * Run the loop.
2335 *
2336 * > ***NOTE:***
2337 * > This method is called by http\Client::send(), so it does not need to have an actual implementation if http\Client::send() is never called.
2338 */
2339 function send();
2340 /**
2341 * Register (or deregister) a socket watcher.
2342 *
2343 * @param resource $socket The socket descriptor to watch.
2344 * @param int $poll http\Client\Curl\User::POLL_* constant.
2345 */
2346 function socket($socket, int $poll);
2347 /**
2348 * Register a timeout watcher.
2349 *
2350 * @param int $timeout_ms Desired maximum timeout in milliseconds.
2351 */
2352 function timer(int $timeout_ms);
2353 /**
2354 * Wait/poll/select (block the loop) until events fire.
2355 *
2356 * > ***NOTE:***
2357 * > This method is called by http\Client::wait(), so it does not need to have an actual implementation if http\Client::wait() is never called.
2358 *
2359 * @param int $timeout_ms Block for at most this milliseconds.
2360 */
2361 function wait(int $timeout_ms = null);
2362 }
2363 /**
2364 * CURL feature constants.
2365 *
2366 * > ***NOTE:***
2367 * > These constants have been added in v2.6.0, resp. v3.1.0.
2368 */
2369 namespace http\Client\Curl\Features;
2370 /**
2371 * Whether libcurl supports asynchronous domain name resolution.
2372 */
2373 const ASYNCHDNS = 128;
2374 /**
2375 * Whether libcurl supports the Generic Security Services Application Program Interface. Available if libcurl is v7.38.0 or more recent.
2376 */
2377 const GSSAPI = 131072;
2378 /**
2379 * Whether libcurl supports HTTP Generic Security Services negotiation.
2380 */
2381 const GSSNEGOTIATE = 32;
2382 /**
2383 * Whether libcurl supports the HTTP/2 protocol. Available if libcurl is v7.33.0 or more recent.
2384 */
2385 const HTTP2 = 65536;
2386 /**
2387 * Whether libcurl supports international domain names.
2388 */
2389 const IDN = 1024;
2390 /**
2391 * Whether libcurl supports IPv6.
2392 */
2393 const IPV6 = 1;
2394 /**
2395 * Whether libcurl supports the old Kerberos protocol.
2396 */
2397 const KERBEROS4 = 2;
2398 /**
2399 * Whether libcurl supports the more recent Kerberos v5 protocol. Available if libcurl is v7.40.0 or more recent.
2400 */
2401 const KERBEROS5 = 262144;
2402 /**
2403 * Whether libcurl supports large files.
2404 */
2405 const LARGEFILE = 512;
2406 /**
2407 * Whether libcurl supports gzip/deflate compression.
2408 */
2409 const LIBZ = 8;
2410 /**
2411 * Whether libcurl supports the NT Lan Manager authentication.
2412 */
2413 const NTLM = 16;
2414 /**
2415 * Whether libcurl supports NTLM delegation to a winbind helper. Available if libcurl is v7.22.0 or more recent.
2416 */
2417 const NTLM_WB = 32768;
2418 /**
2419 * Whether libcurl supports the Public Suffix List for cookie host handling. Available if libcurl is v7.47.0 or more recent.
2420 */
2421 const PSL = 1048576;
2422 /**
2423 * Whether libcurl supports the Simple and Protected GSSAPI Negotiation Mechanism.
2424 */
2425 const SPNEGO = 256;
2426 /**
2427 * Whether libcurl supports SSL/TLS protocols.
2428 */
2429 const SSL = 4;
2430 /**
2431 * Whether libcurl supports the Security Support Provider Interface.
2432 */
2433 const SSPI = 2048;
2434 /**
2435 * Whether libcurl supports TLS Secure Remote Password authentication. Available if libcurl is v7.21.4 or more recent.
2436 */
2437 const TLSAUTH_SRP = 16384;
2438 /**
2439 * Whether libcurl supports connections to unix sockets. Available if libcurl is v7.40.0 or more recent.
2440 */
2441 const UNIX_SOCKETS = 524288;
2442 /**
2443 * CURL version constants.
2444 */
2445 namespace http\Client\Curl\Versions;
2446 /**
2447 * Version string of libcurl, e.g. "7.50.0".
2448 */
2449 const CURL = '7.68.0';
2450 /**
2451 * Version string of the SSL/TLS library, e.g. "OpenSSL/1.0.2h".
2452 */
2453 const SSL = 'OpenSSL/1.1.1f';
2454 /**
2455 * Version string of the zlib compression library, e.g. "1.2.8".
2456 */
2457 const LIBZ = '1.2.11';
2458 /**
2459 * Version string of the c-ares library, e.g. "1.11.0".
2460 */
2461 const ARES = NULL;
2462 /**
2463 * Version string of the IDN library, e.g. "1.32".
2464 */
2465 const IDN = '2.2.0';
2466 /**
2467 * Version string of the iconv library. Added in v4.1.0.
2468 */
2469 const ICONV = NULL;
2470 /**
2471 * Version string of the brotli library. Added in v4.1.0. Available if libcurl is v7.57.0 or more recent.
2472 */
2473 const BROTLI = '1.0.7';
2474 /**
2475 * Version string of nghttp2. Added in v4.1.0. Available if libcurl is v7.66.0 or more recent.
2476 */
2477 const NGHTTP2 = '1.40.0';
2478 /**
2479 * Version string of quiche/nghttp3. Added in v4.1.0. Available if libcurl is v7.66.0 or more recent.
2480 */
2481 const QUIC = NULL;
2482 /**
2483 * Default path to the certificate bundle file. Added in v4.1.0. Available if libcurl is v7.70.0 or more recent.
2484 */
2485 const CAINFO = NULL;
2486 /**
2487 * Default path to the certificate bundle directory. Added in v4.1.0. Available if libcurl is v7.70.0 or more recent.
2488 */
2489 const CAPATH = NULL;
2490 /**
2491 * Version string of the zstd library. Added in v4.1.0. Available if libcurl is v7.72.0 or more recent.
2492 */
2493 const ZSTD = NULL;
2494 /**
2495 * Version string of the hyper library. Added in v4.1.0. Available if libcurl is v7.75.0 or more recent.
2496 */
2497 const HYPER = NULL;
2498 namespace http\Encoding;
2499 /**
2500 * Base class for encoding stream implementations.
2501 */
2502 abstract class Stream {
2503 /**
2504 * Do no intermittent flushes.
2505 */
2506 const FLUSH_NONE = 0;
2507 /**
2508 * Flush at appropriate transfer points.
2509 */
2510 const FLUSH_SYNC = 1048576;
2511 /**
2512 * Flush at each IO operation.
2513 */
2514 const FLUSH_FULL = 2097152;
2515 /**
2516 * Base constructor for encoding stream implementations.
2517 *
2518 * @param int $flags See http\Encoding\Stream and implementation specific constants.
2519 * @throws \http\Exception\InvalidArgumentException
2520 * @throws \http\Exception\RuntimeException
2521 */
2522 function __construct(int $flags = 0) {}
2523 /**
2524 * Check whether the encoding stream is already done.
2525 *
2526 * @return bool whether the encoding stream is completed.
2527 */
2528 function done() {}
2529 /**
2530 * Finish and reset the encoding stream.
2531 * Returns any pending data.
2532 *
2533 * @return string any pending data.
2534 */
2535 function finish() {}
2536 /**
2537 * Flush the encoding stream.
2538 * Returns any pending data.
2539 *
2540 * @return string any pending data.
2541 */
2542 function flush() {}
2543 /**
2544 * Update the encoding stream with more input.
2545 *
2546 * @param string $data The data to pass through the stream.
2547 * @return string processed data.
2548 */
2549 function update(string $data) {}
2550 }
2551 namespace http\Encoding\Stream;
2552 /**
2553 * A [brotli](https://brotli.org) decoding stream.
2554 *
2555 * > ***NOTE:***
2556 * > This class has been added in v3.2.0.
2557 */
2558 class Debrotli extends \http\Encoding\Stream {
2559 /**
2560 * Decode brotli encoded data.
2561 *
2562 * @param string $data The data to uncompress.
2563 * @return string the uncompressed data.
2564 */
2565 function decode(string $data) {}
2566 }
2567 /**
2568 * A stream decoding data encoded with chunked transfer encoding.
2569 */
2570 class Dechunk extends \http\Encoding\Stream {
2571 /**
2572 * Decode chunked encoded data.
2573 *
2574 * @param string $data The data to decode.
2575 * @param int $decoded_len Out parameter with the length of $data that's been decoded.
2576 * Should be ```strlen($data)``` if not truncated.
2577 * @return string|string|string|false string the decoded data.
2578 * or string the unencoded data.
2579 * or string the truncated decoded data.
2580 * or false if $data cannot be decoded.
2581 */
2582 function decode(string $data, int &$decoded_len = 0) {}
2583 }
2584 /**
2585 * A deflate stream supporting deflate, zlib and gzip encodings.
2586 */
2587 class Deflate extends \http\Encoding\Stream {
2588 /**
2589 * Gzip encoding. RFC1952
2590 */
2591 const TYPE_GZIP = 16;
2592 /**
2593 * Zlib encoding. RFC1950
2594 */
2595 const TYPE_ZLIB = 0;
2596 /**
2597 * Deflate encoding. RFC1951
2598 */
2599 const TYPE_RAW = 32;
2600 /**
2601 * Default compression level.
2602 */
2603 const LEVEL_DEF = 0;
2604 /**
2605 * Least compression level.
2606 */
2607 const LEVEL_MIN = 1;
2608 /**
2609 * Greatest compression level.
2610 */
2611 const LEVEL_MAX = 9;
2612 /**
2613 * Default compression strategy.
2614 */
2615 const STRATEGY_DEF = 0;
2616 /**
2617 * Filtered compression strategy.
2618 */
2619 const STRATEGY_FILT = 256;
2620 /**
2621 * Huffman strategy only.
2622 */
2623 const STRATEGY_HUFF = 512;
2624 /**
2625 * Run-length encoding strategy.
2626 */
2627 const STRATEGY_RLE = 768;
2628 /**
2629 * Encoding with fixed Huffman codes only.
2630 *
2631 * > **A note on the compression strategy:**
2632 * >
2633 * > The strategy parameter is used to tune the compression algorithm.
2634 * >
2635 * > Use the value DEFAULT_STRATEGY for normal data, FILTERED for data produced by a filter (or predictor), HUFFMAN_ONLY to force Huffman encoding only (no string match), or RLE to limit match distances to one (run-length encoding).
2636 * >
2637 * > Filtered data consists mostly of small values with a somewhat random distribution. In this case, the compression algorithm is tuned to compress them better. The effect of FILTERED is to force more Huffman coding and less string matching; it is somewhat intermediate between DEFAULT_STRATEGY and HUFFMAN_ONLY.
2638 * >
2639 * > RLE is designed to be almost as fast as HUFFMAN_ONLY, but give better compression for PNG image data.
2640 * >
2641 * > FIXED prevents the use of dynamic Huffman codes, allowing for a simpler decoder for special applications.
2642 * >
2643 * > The strategy parameter only affects the compression ratio but not the correctness of the compressed output even if it is not set appropriately.
2644 * >
2645 * >_Source: [zlib Manual](http://www.zlib.net/manual.html)_
2646 */
2647 const STRATEGY_FIXED = 1024;
2648 /**
2649 * Encode data with deflate/zlib/gzip encoding.
2650 *
2651 * @param string $data The data to compress.
2652 * @param int $flags Any compression tuning flags. See http\Encoding\Stream\Deflate and http\Encoding\Stream constants.
2653 * @return string the compressed data.
2654 */
2655 function encode(string $data, int $flags = 0) {}
2656 }
2657 /**
2658 * A [brotli](https://brotli.org) encoding stream.
2659 *
2660 * > ***NOTE:***
2661 * > This class has been added in v3.2.0.
2662 */
2663 class Enbrotli extends \http\Encoding\Stream {
2664 /**
2665 * Default compression level.
2666 */
2667 const LEVEL_DEF = 4;
2668 /**
2669 * Least compression level.
2670 */
2671 const LEVEL_MIN = 1;
2672 /**
2673 * Greatest compression level.
2674 */
2675 const LEVEL_MAX = 11;
2676 /**
2677 * Default window bits.
2678 */
2679 const WBITS_DEF = 352;
2680 /**
2681 * Minimum window bits.
2682 */
2683 const WBITS_MIN = 160;
2684 /**
2685 * Maximum window bits.
2686 */
2687 const WBITS_MAX = 384;
2688 /**
2689 * Default compression mode.
2690 */
2691 const MODE_GENERIC = 0;
2692 /**
2693 * Compression mode for UTF-8 formatted text.
2694 */
2695 const MODE_TEXT = 4096;
2696 /**
2697 * Compression mode used in WOFF 2.0.
2698 */
2699 const MODE_FONT = 8192;
2700 /**
2701 * Encode data with brotli encoding.
2702 *
2703 * @param string $data The data to compress.
2704 * @param int $flags Any compression tuning flags. See http\Encoding\Stream\Enbrotli and http\Encoding\Stream constants.
2705 * @return string the compressed data.
2706 */
2707 function encode(string $data, int $flags = 0) {}
2708 }
2709 /**
2710 * A inflate stream supporting deflate, zlib and gzip encodings.
2711 */
2712 class Inflate extends \http\Encoding\Stream {
2713 /**
2714 * Decode deflate/zlib/gzip encoded data.
2715 *
2716 * @param string $data The data to uncompress.
2717 * @return string the uncompressed data.
2718 */
2719 function decode(string $data) {}
2720 }
2721 namespace http\Env;
2722 /**
2723 * The http\Env\Request class' instances represent the server's current HTTP request.
2724 *
2725 * See http\Message for inherited members.
2726 */
2727 class Request extends \http\Message {
2728 /**
2729 * The request's query parameters. ($_GET)
2730 *
2731 * @protected
2732 * @var \http\QueryString
2733 */
2734 protected $query = NULL;
2735 /**
2736 * The request's form parameters. ($_POST)
2737 *
2738 * @protected
2739 * @var \http\QueryString
2740 */
2741 protected $form = NULL;
2742 /**
2743 * The request's form uploads. ($_FILES)
2744 *
2745 * @protected
2746 * @var array
2747 */
2748 protected $files = NULL;
2749 /**
2750 * The request's cookies. ($_COOKIE)
2751 *
2752 * @protected
2753 * @var array
2754 */
2755 protected $cookie = NULL;
2756 /**
2757 * Create an instance of the server's current HTTP request.
2758 *
2759 * Upon construction, the http\Env\Request acquires http\QueryString instances of query parameters ($\_GET) and form parameters ($\_POST).
2760 *
2761 * It also compiles an array of uploaded files ($\_FILES) more comprehensive than the original $\_FILES array, see http\Env\Request::getFiles() for that matter.
2762 *
2763 * @throws \http\Exception\InvalidArgumentException
2764 * @throws \http\Exception\UnexpectedValueException
2765 */
2766 function __construct() {}
2767 /**
2768 * Retrieve an URL query value ($_GET).
2769 *
2770 * See http\QueryString::get() and http\QueryString::TYPE_* constants.
2771 *
2772 * @param string $name The key to retrieve the value for.
2773 * @param mixed $type The type to cast the value to. See http\QueryString::TYPE_* constants.
2774 * @param mixed $defval The default value to return if the key $name does not exist.
2775 * @param bool $delete Whether to delete the entry from the querystring after retrieval.
2776 * @return \http\QueryString|string|mixed|mixed|string \http\QueryString if called without arguments.
2777 * or string the whole querystring if $name is of zero length.
2778 * or mixed $defval if the key $name does not exist.
2779 * or mixed the querystring value cast to $type if $type was specified and the key $name exists.
2780 * or string the querystring value if the key $name exists and $type is not specified or equals http\QueryString::TYPE_STRING.
2781 */
2782 function getCookie(string $name = NULL, $type = NULL, $defval = NULL, bool $delete = false) {}
2783 /**
2784 * Retrieve the uploaded files list ($_FILES).
2785 *
2786 * @return array the consolidated upload files array.
2787 */
2788 function getFiles() {}
2789 /**
2790 * Retrieve a form value ($_POST).
2791 *
2792 * See http\QueryString::get() and http\QueryString::TYPE_* constants.
2793 *
2794 * @param string $name The key to retrieve the value for.
2795 * @param mixed $type The type to cast the value to. See http\QueryString::TYPE_* constants.
2796 * @param mixed $defval The default value to return if the key $name does not exist.
2797 * @param bool $delete Whether to delete the entry from the querystring after retrieval.
2798 * @return \http\QueryString|string|mixed|mixed|string \http\QueryString if called without arguments.
2799 * or string the whole querystring if $name is of zero length.
2800 * or mixed $defval if the key $name does not exist.
2801 * or mixed the querystring value cast to $type if $type was specified and the key $name exists.
2802 * or string the querystring value if the key $name exists and $type is not specified or equals http\QueryString::TYPE_STRING.
2803 */
2804 function getForm(string $name = NULL, $type = NULL, $defval = NULL, bool $delete = false) {}
2805 /**
2806 * Retrieve an URL query value ($_GET).
2807 *
2808 * See http\QueryString::get() and http\QueryString::TYPE_* constants.
2809 *
2810 * @param string $name The key to retrieve the value for.
2811 * @param mixed $type The type to cast the value to. See http\QueryString::TYPE_* constants.
2812 * @param mixed $defval The default value to return if the key $name does not exist.
2813 * @param bool $delete Whether to delete the entry from the querystring after retrieval.
2814 * @return \http\QueryString|string|mixed|mixed|string \http\QueryString if called without arguments.
2815 * or string the whole querystring if $name is of zero length.
2816 * or mixed $defval if the key $name does not exist.
2817 * or mixed the querystring value cast to $type if $type was specified and the key $name exists.
2818 * or string the querystring value if the key $name exists and $type is not specified or equals http\QueryString::TYPE_STRING.
2819 */
2820 function getQuery(string $name = NULL, $type = NULL, $defval = NULL, bool $delete = false) {}
2821 }
2822 /**
2823 * The http\Env\Response class' instances represent the server's current HTTP response.
2824 *
2825 * See http\Message for inherited members.
2826 */
2827 class Response extends \http\Message {
2828 /**
2829 * Do not use content encoding.
2830 */
2831 const CONTENT_ENCODING_NONE = 0;
2832 /**
2833 * Support "Accept-Encoding" requests with gzip and deflate encoding.
2834 */
2835 const CONTENT_ENCODING_GZIP = 1;
2836 /**
2837 * No caching info available.
2838 */
2839 const CACHE_NO = 0;
2840 /**
2841 * The cache was hit.
2842 */
2843 const CACHE_HIT = 1;
2844 /**
2845 * The cache was missed.
2846 */
2847 const CACHE_MISS = 2;
2848 /**
2849 * A request instance which overrides the environments default request.
2850 *
2851 * @protected
2852 * @var \http\Env\Request
2853 */
2854 protected $request = NULL;
2855 /**
2856 * The response's MIME content type.
2857 *
2858 * @protected
2859 * @var string
2860 */
2861 protected $contentType = NULL;
2862 /**
2863 * The response's MIME content disposition.
2864 *
2865 * @protected
2866 * @var string
2867 */
2868 protected $contentDisposition = NULL;
2869 /**
2870 * See http\Env\Response::CONTENT_ENCODING_* constants.
2871 *
2872 * @protected
2873 * @var int
2874 */
2875 protected $contentEncoding = NULL;
2876 /**
2877 * How the client should treat this response in regards to caching.
2878 *
2879 * @protected
2880 * @var string
2881 */
2882 protected $cacheControl = NULL;
2883 /**
2884 * A custom ETag.
2885 *
2886 * @protected
2887 * @var string
2888 */
2889 protected $etag = NULL;
2890 /**
2891 * A "Last-Modified" time stamp.
2892 *
2893 * @protected
2894 * @var int
2895 */
2896 protected $lastModified = NULL;
2897 /**
2898 * Any throttling delay.
2899 *
2900 * @protected
2901 * @var int
2902 */
2903 protected $throttleDelay = NULL;
2904 /**
2905 * The chunk to send every $throttleDelay seconds.
2906 *
2907 * @protected
2908 * @var int
2909 */
2910 protected $throttleChunk = NULL;
2911 /**
2912 * The response's cookies.
2913 *
2914 * @protected
2915 * @var array
2916 */
2917 protected $cookies = NULL;
2918 /**
2919 * Create a new env response message instance.
2920 *
2921 * @throws \http\Exception\InvalidArgumentException
2922 * @throws \http\Exception\UnexpectedValueException
2923 */
2924 function __construct() {}
2925 /**
2926 * Output buffer handler.
2927 * Appends output data to the body.
2928 *
2929 * @param string $data The data output.
2930 * @param int $ob_flags Output buffering flags passed from the output buffering control layer.
2931 * @return bool success.
2932 */
2933 function __invoke(string $data, int $ob_flags = 0) {}
2934 /**
2935 * Manually test the header $header_name of the environment's request for a cache hit.
2936 * http\Env\Response::send() checks that itself, though.
2937 *
2938 * @param string $header_name The request header to test.
2939 * @return int a http\Env\Response::CACHE_* constant.
2940 */
2941 function isCachedByEtag(string $header_name = "If-None-Match") {}
2942 /**
2943 * Manually test the header $header_name of the environment's request for a cache hit.
2944 * http\Env\Response::send() checks that itself, though.
2945 *
2946 * @param string $header_name The request header to test.
2947 * @return int a http\Env\Response::CACHE_* constant.
2948 */
2949 function isCachedByLastModified(string $header_name = "If-Modified-Since") {}
2950 /**
2951 * Send the response through the SAPI or $stream.
2952 * Flushes all output buffers.
2953 *
2954 * @param resource $stream A writable stream to send the response through.
2955 * @return bool success.
2956 */
2957 function send($stream = NULL) {}
2958 /**
2959 * Make suggestions to the client how it should cache the response.
2960 *
2961 * @param string $cache_control (A) "Cache-Control" header value(s).
2962 * @throws \http\Exception\InvalidArgumentException
2963 * @return \http\Env\Response self.
2964 */
2965 function setCacheControl(string $cache_control) {}
2966 /**
2967 * Set the reponse's content disposition parameters.
2968 *
2969 * @param array $disposition_params MIME content disposition as http\Params array.
2970 * @throws \http\Exception\InvalidArgumentException
2971 * @return \http\Env\Response self.
2972 */
2973 function setContentDisposition(array $disposition_params) {}
2974 /**
2975 * Enable support for "Accept-Encoding" requests with deflate or gzip.
2976 * The response will be compressed if the client indicates support and wishes that.
2977 *
2978 * @param int $content_encoding See http\Env\Response::CONTENT_ENCODING_* constants.
2979 * @throws \http\Exception\InvalidArgumentException
2980 * @return \http\Env\Response self.
2981 */
2982 function setContentEncoding(int $content_encoding) {}
2983 /**
2984 * Set the MIME content type of the response.
2985 *
2986 * @param string $content_type The response's content type.
2987 * @throws \http\Exception\InvalidArgumentException
2988 * @return \http\Env\Response self.
2989 */
2990 function setContentType(string $content_type) {}
2991 /**
2992 * Add cookies to the response to send.
2993 *
2994 * @param mixed $cookie The cookie to send.
2995 * @throws \http\Exception\InvalidArgumentException
2996 * @throws \http\Exception\UnexpectedValueException
2997 * @return \http\Env\Response self.
2998 */
2999 function setCookie($cookie) {}
3000 /**
3001 * Override the environment's request.
3002 *
3003 * @param \http\Message $env_request The overriding request message.
3004 * @throws \http\Exception\InvalidArgumentException
3005 * @return \http\Env\Response self.
3006 */
3007 function setEnvRequest(\http\Message $env_request) {}
3008 /**
3009 * Set a custom ETag.
3010 *
3011 * > ***NOTE:***
3012 * > This will be used for caching and pre-condition checks.
3013 *
3014 * @param string $etag A ETag.
3015 * @throws \http\Exception\InvalidArgumentException
3016 * @return \http\Env\Response self.
3017 */
3018 function setEtag(string $etag) {}
3019 /**
3020 * Set a custom last modified time stamp.
3021 *
3022 * > ***NOTE:***
3023 * > This will be used for caching and pre-condition checks.
3024 *
3025 * @param int $last_modified A unix timestamp.
3026 * @throws \http\Exception\InvalidArgumentException
3027 * @return \http\Env\Response self.
3028 */
3029 function setLastModified(int $last_modified) {}
3030 /**
3031 * Enable throttling.
3032 * Send $chunk_size bytes every $delay seconds.
3033 *
3034 * > ***NOTE:***
3035 * > If you need throttling by regular means, check for other options in your stack, because this method blocks the executing process/thread until the response has completely been sent.
3036 *
3037 * @param int $chunk_size Bytes to send.
3038 * @param float $delay Seconds to sleep.
3039 * @return \http\Env\Response self.
3040 */
3041 function setThrottleRate(int $chunk_size, float $delay = 1) {}
3042 }
3043 /**
3044 * URL class using the HTTP environment by default.
3045 *
3046 * > ***NOTE:***
3047 * > This class has been added in v3.0.0.
3048 *
3049 * Always adds http\Url::FROM_ENV to the $flags constructor argument. See also http\Url.
3050 */
3051 class Url extends \http\Url {
3052 }
3053 namespace http\Exception;
3054 /**
3055 * A bad conversion (e.g. character conversion) was encountered.
3056 */
3057 class BadConversionException extends \DomainException implements \http\Exception {
3058 }
3059 /**
3060 * A bad HTTP header was encountered.
3061 */
3062 class BadHeaderException extends \DomainException implements \http\Exception {
3063 }
3064 /**
3065 * A bad HTTP message was encountered.
3066 */
3067 class BadMessageException extends \DomainException implements \http\Exception {
3068 }
3069 /**
3070 * A method was called on an object, which was in an invalid or unexpected state.
3071 */
3072 class BadMethodCallException extends \BadMethodCallException implements \http\Exception {
3073 }
3074 /**
3075 * A bad querystring was encountered.
3076 */
3077 class BadQueryStringException extends \DomainException implements \http\Exception {
3078 }
3079 /**
3080 * A bad HTTP URL was encountered.
3081 */
3082 class BadUrlException extends \DomainException implements \http\Exception {
3083 }
3084 /**
3085 * One or more invalid arguments were passed to a method.
3086 */
3087 class InvalidArgumentException extends \InvalidArgumentException implements \http\Exception {
3088 }
3089 /**
3090 * A generic runtime exception.
3091 */
3092 class RuntimeException extends \RuntimeException implements \http\Exception {
3093 }
3094 /**
3095 * An unexpected value was encountered.
3096 */
3097 class UnexpectedValueException extends \UnexpectedValueException implements \http\Exception {
3098 }
3099 namespace http\Header;
3100 /**
3101 * The parser which is underlying http\Header and http\Message.
3102 *
3103 * > ***NOTE:***
3104 * > This class has been added in v2.3.0.
3105 */
3106 class Parser {
3107 /**
3108 * Finish up parser at end of (incomplete) input.
3109 */
3110 const CLEANUP = 1;
3111 /**
3112 * Parse failure.
3113 */
3114 const STATE_FAILURE = -1;
3115 /**
3116 * Expecting HTTP info (request/response line) or headers.
3117 */
3118 const STATE_START = 0;
3119 /**
3120 * Expecting a key or already parsing a key.
3121 */
3122 const STATE_KEY = 1;
3123 /**
3124 * Expecting a value or already parsing the value.
3125 */
3126 const STATE_VALUE = 2;
3127 /**
3128 * At EOL of an header, checking whether a folded header line follows.
3129 */
3130 const STATE_VALUE_EX = 3;
3131 /**
3132 * A header was completed.
3133 */
3134 const STATE_HEADER_DONE = 4;
3135 /**
3136 * Finished parsing the headers.
3137 *
3138 * > ***NOTE:***
3139 * > Most of this states won't be returned to the user, because the parser immediately jumps to the next expected state.
3140 */
3141 const STATE_DONE = 5;
3142 /**
3143 * Retrieve the current state of the parser.
3144 * See http\Header\Parser::STATE_* constants.
3145 *
3146 * @throws \http\Exception\InvalidArgumentException
3147 * @return int http\Header\Parser::STATE_* constant.
3148 */
3149 function getState() {}
3150 /**
3151 * Parse a string.
3152 *
3153 * @param string $data The (part of the) header to parse.
3154 * @param int $flags Any combination of [parser flags](http/Header/Parser#Parser.flags:).
3155 * @param array $header Successfully parsed headers.
3156 * @throws \http\Exception\InvalidArgumentException
3157 * @return int http\Header\Parser::STATE_* constant.
3158 */
3159 function parse(string $data, int $flags, array &$header = NULL) {}
3160 /**
3161 * Parse a stream.
3162 *
3163 * @param resource $stream The header stream to parse from.
3164 * @param int $flags Any combination of [parser flags](http/Header/Parser#Parser.flags:).
3165 * @param array $headers The headers parsed.
3166 * @throws \http\Exception\InvalidArgumentException
3167 * @throws \http\Exception\UnexpectedValueException
3168 * @return int http\Header\Parser::STATE_* constant.
3169 */
3170 function stream($stream, int $flags, array &$headers) {}
3171 }
3172 namespace http\Message;
3173 /**
3174 * The message body, represented as a PHP (temporary) stream.
3175 *
3176 * > ***NOTE:***
3177 * > Currently, http\Message\Body::addForm() creates multipart/form-data bodies.
3178 */
3179 class Body implements \Serializable {
3180 /**
3181 * Create a new message body, optionally referencing $stream.
3182 *
3183 * @param resource $stream A stream to be used as message body.
3184 * @throws \http\Exception\InvalidArgumentException
3185 * @throws \http\Exception\UnexpectedValueException
3186 */
3187 function __construct($stream = NULL) {}
3188 /**
3189 * String cast handler.
3190 *
3191 * @return string the message body.
3192 */
3193 function __toString() {}
3194 /**
3195 * Add form fields and files to the message body.
3196 *
3197 * > ***NOTE:***
3198 * > Currently, http\Message\Body::addForm() creates "multipart/form-data" bodies.
3199 *
3200 * @param array $fields List of form fields to add.
3201 * @param array $files List of form files to add.
3202 *
3203 * $fields must look like:
3204 *
3205 * [
3206 * "field_name" => "value",
3207 * "multi_field" => [
3208 * "value1",
3209 * "value2"
3210 * ]
3211 * ]
3212 *
3213 * $files must look like:
3214 *
3215 * [
3216 * [
3217 * "name" => "field_name",
3218 * "type" => "content/type",
3219 * "file" => "/path/to/file.ext"
3220 * ], [
3221 * "name" => "field_name2",
3222 * "type" => "text/plain",
3223 * "file" => "file.ext",
3224 * "data" => "string"
3225 * ], [
3226 * "name" => "field_name3",
3227 * "type" => "image/jpeg",
3228 * "file" => "file.ext",
3229 * "data" => fopen("/home/mike/Pictures/mike.jpg","r")
3230 * ]
3231 *
3232 * As you can see, a file structure must contain a "file" entry, which holds a file path, and an optional "data" entry, which may either contain a resource to read from or the actual data as string.
3233 * @throws \http\Exception\InvalidArgumentException
3234 * @throws \http\Exception\RuntimeException
3235 * @return \http\Message\Body self.
3236 */
3237 function addForm(array $fields = NULL, array $files = NULL) {}
3238 /**
3239 * Add a part to a multipart body.
3240 *
3241 * @param \http\Message $part The message part.
3242 * @throws \http\Exception\InvalidArgumentException
3243 * @throws \http\Exception\RuntimeException
3244 * @return \http\Message\Body self.
3245 */
3246 function addPart(\http\Message $part) {}
3247 /**
3248 * Append plain bytes to the message body.
3249 *
3250 * @param string $data The data to append to the body.
3251 * @throws \http\Exception\InvalidArgumentException
3252 * @throws \http\Exception\RuntimeException
3253 * @return \http\Message\Body self.
3254 */
3255 function append(string $data) {}
3256 /**
3257 * Retrieve the ETag of the body.
3258 *
3259 * @return string|string|false string an Apache style ETag of inode, mtime and size in hex concatenated by hyphens if the message body stream is stat-able.
3260 * or string a content hash (which algorithm is determined by INI http.etag.mode) if the stream is not stat-able.
3261 * or false if http.etag.mode is not a known hash algorithm.
3262 */
3263 function etag() {}
3264 /**
3265 * Retrieve any boundary of the message body.
3266 * See http\Message::splitMultipartBody().
3267 *
3268 * @return string|NULL string the message body boundary.
3269 * or NULL if this message body has no boundary.
3270 */
3271 function getBoundary() {}
3272 /**
3273 * Retrieve the underlying stream resource.
3274 *
3275 * @return resource the underlying stream.
3276 */
3277 function getResource() {}
3278 /**
3279 * Implements Serializable.
3280 * Alias of http\Message\Body::__toString().
3281 *
3282 * @return string serialized message body.
3283 */
3284 function serialize() {}
3285 /**
3286 * Stat size, atime, mtime and/or ctime.
3287 *
3288 * @param string $field A single stat field to retrieve.
3289 * @return int|object int the requested stat field.
3290 * or object stdClass instance holding all four stat fields.
3291 */
3292 function stat(string $field = NULL) {}
3293 /**
3294 * Stream the message body through a callback.
3295 *
3296 * @param callable $callback The callback of the form function(http\Message\Body $from, string $data).
3297 * @param int $offset Start to stream from this offset.
3298 * @param int $maxlen Stream at most $maxlen bytes, or all if $maxlen is less than 1.
3299 * @return \http\Message\Body self.
3300 */
3301 function toCallback(callable $callback, int $offset = 0, int $maxlen = 0) {}
3302 /**
3303 * Stream the message body into another stream $stream, starting from $offset, streaming $maxlen at most.
3304 *
3305 * @param resource $stream The resource to write to.
3306 * @param int $offset The starting offset.
3307 * @param int $maxlen The maximum amount of data to stream. All content if less than 1.
3308 * @return \http\Message\Body self.
3309 */
3310 function toStream($stream, int $offset = 0, int $maxlen = 0) {}
3311 /**
3312 * Retrieve the message body serialized to a string.
3313 * Alias of http\Message\Body::__toString().
3314 *
3315 * @return string message body.
3316 */
3317 function toString() {}
3318 /**
3319 * Implements Serializable.
3320 *
3321 * @param string $serialized The serialized message body.
3322 */
3323 function unserialize($serialized) {}
3324 }
3325 /**
3326 * The parser which is underlying http\Message.
3327 *
3328 * > ***NOTE:***
3329 * > This class was added in v2.2.0.
3330 */
3331 class Parser {
3332 /**
3333 * Finish up parser at end of (incomplete) input.
3334 */
3335 const CLEANUP = 1;
3336 /**
3337 * Soak up the rest of input if no entity length is deducible.
3338 */
3339 const DUMB_BODIES = 2;
3340 /**
3341 * Redirect messages do not contain any body despite of indication of such.
3342 */
3343 const EMPTY_REDIRECTS = 4;
3344 /**
3345 * Continue parsing while input is available.
3346 */
3347 const GREEDY = 8;
3348 /**
3349 * Parse failure.
3350 */
3351 const STATE_FAILURE = -1;
3352 /**
3353 * Expecting HTTP info (request/response line) or headers.
3354 */
3355 const STATE_START = 0;
3356 /**
3357 * Parsing headers.
3358 */
3359 const STATE_HEADER = 1;
3360 /**
3361 * Completed parsing headers.
3362 */
3363 const STATE_HEADER_DONE = 2;
3364 /**
3365 * Parsing the body.
3366 */
3367 const STATE_BODY = 3;
3368 /**
3369 * Soaking up all input as body.
3370 */
3371 const STATE_BODY_DUMB = 4;
3372 /**
3373 * Reading body as indicated by `Content-Length` or `Content-Range`.
3374 */
3375 const STATE_BODY_LENGTH = 5;
3376 /**
3377 * Parsing `chunked` encoded body.
3378 */
3379 const STATE_BODY_CHUNKED = 6;
3380 /**
3381 * Finished parsing the body.
3382 */
3383 const STATE_BODY_DONE = 7;
3384 /**
3385 * Updating Content-Length based on body size.
3386 */
3387 const STATE_UPDATE_CL = 8;
3388 /**
3389 * Finished parsing the message.
3390 *
3391 * > ***NOTE:***
3392 * > Most of this states won't be returned to the user, because the parser immediately jumps to the next expected state.
3393 */
3394 const STATE_DONE = 9;
3395 /**
3396 * Retrieve the current state of the parser.
3397 * See http\Message\Parser::STATE_* constants.
3398 *
3399 * @throws \http\Exception\InvalidArgumentException
3400 * @return int http\Message\Parser::STATE_* constant.
3401 */
3402 function getState() {}
3403 /**
3404 * Parse a string.
3405 *
3406 * @param string $data The (part of the) message to parse.
3407 * @param int $flags Any combination of [parser flags](http/Message/Parser#Parser.flags:).
3408 * @param \http\Message $message The current state of the message parsed.
3409 * @throws \http\Exception\InvalidArgumentException
3410 * @return int http\Message\Parser::STATE_* constant.
3411 */
3412 function parse(string $data, int $flags, \http\Message &$message) {}
3413 /**
3414 * Parse a stream.
3415 *
3416 * @param resource $stream The message stream to parse from.
3417 * @param int $flags Any combination of [parser flags](http/Message/Parser#Parser.flags:).
3418 * @param \http\Message $message The current state of the message parsed.
3419 * @throws \http\Exception\InvalidArgumentException
3420 * @throws \http\Exception\UnexpectedValueException
3421 * @return int http\Message\Parser::STATE_* constant.
3422 */
3423 function stream($stream, int $flags, \http\Message &$message) {}
3424 }