Created
February 28, 2019 10:36
-
-
Save m6w6/49b10cf182d563b47dc1b28c7c1a2644 to your computer and use it in GitHub Desktop.
ext-http stub
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Extended HTTP support. Again. | |
* * Introduces the http namespace. | |
* * PHP stream based message bodies. | |
* * Encapsulated env request/response. | |
* * Modular client support. | |
*/ | |
namespace http; | |
use http; | |
/** | |
* The HTTP client. See http\Client\Curl's [options](http/Client/Curl#Options:) which is the only driver currently supported. | |
*/ | |
class Client implements \SplSubject, \Countable { | |
/** | |
* Debug callback's $data contains human readable text. | |
*/ | |
const DEBUG_INFO = 0; | |
/** | |
* Debug callback's $data contains data received. | |
*/ | |
const DEBUG_IN = 1; | |
/** | |
* Debug callback's $data contains data sent. | |
*/ | |
const DEBUG_OUT = 2; | |
/** | |
* Debug callback's $data contains headers. | |
*/ | |
const DEBUG_HEADER = 16; | |
/** | |
* Debug callback's $data contains a body part. | |
*/ | |
const DEBUG_BODY = 32; | |
/** | |
* Debug callback's $data contains SSL data. | |
*/ | |
const DEBUG_SSL = 64; | |
/** | |
* Attached observers. | |
* @private | |
* @var SplObjectStorage | |
*/ | |
private $observers = NULL; | |
/** | |
* Set options. | |
* @protected | |
* @var array | |
*/ | |
protected $options = NULL; | |
/** | |
* Request/response history. | |
* @protected | |
* @var http\Message | |
*/ | |
protected $history = NULL; | |
/** | |
* Whether to record history in http\Client::$history. | |
* @public | |
* @var bool | |
*/ | |
public $recordHistory = false; | |
/** | |
* Create a new HTTP client. | |
* @param string $driver The HTTP client driver to employ. Currently only the default driver, "curl", is supported. | |
* @param string $persistent_handle_id If supplied, created curl handles will be persisted with this identifier for later reuse. | |
* @throws http\Exception\InvalidArgumentException | |
* @throws http\Exception\UnexpectedValueException | |
* @throws http\Exception\RuntimeException | |
*/ | |
function __construct($driver = NULL, $persistent_handle_id = NULL) {} | |
/** | |
* Add custom cookies. | |
* @param array $cookies Custom cookies to add. | |
* @throws http\Exception\InvalidArgumentException | |
* @return http\Client self. | |
*/ | |
function addCookies($cookies = NULL) {} | |
/** | |
* Add specific SSL options. | |
* @param array $ssl_options Add this SSL options. | |
* @throws http\Exceptionc\InvalidArgumentException | |
* @return http\Client self. | |
*/ | |
function addSslOptions($ssl_options = NULL) {} | |
/** | |
* Implements SplSubject. Attach another observer. | |
* @param SplObserver $observer An implementation of SplObserver. | |
* @throws http\Exception\InvalidArgumentException | |
* @throws http\Exception\UnexpectedValueException | |
* @return http\Client self. | |
*/ | |
function attach($observer) {} | |
/** | |
* Configure the client's low level options. | |
* @param array $configuration Key/value pairs of low level options. | |
* See f.e. the [configuration options for the Curl driver](http/Client/Curl#Configuration:). | |
* @throws http\Exception\InvalidArgumentException | |
* @throws http\Exception\UnexpectedValueException | |
* @return http\Client self. | |
*/ | |
function configure($configuration) {} | |
/** | |
* Implements Countable. Retrieve the number of enqueued requests. | |
* @return int number of enqueued requests. | |
*/ | |
function count() {} | |
/** | |
* Dequeue the http\Client\Request $request. | |
* @param http\Client\Request $request The request to cancel. | |
* @throws http\Exception\InvalidArgumentException | |
* @throws http\Exception\BadMethodCallException | |
* @throws http\Exception\RuntimeException | |
* @return http\Client self. | |
*/ | |
function dequeue($request) {} | |
/** | |
* Implements SplSubject. Detach $observer, which has been previously attached. | |
* @param SplObserver $observer Previously attached instance of SplObserver implementation. | |
* @throws http\Exception\InvalidArgumentException | |
* @throws http\Exception\UnexpectedValueException | |
* @return http\Client self. | |
*/ | |
function detach($observer) {} | |
/** | |
* Enable usage of an event library like libevent, which might improve performance with big socket sets. | |
* @param bool $enable Whether to enable libevent usage. | |
* @throws http\Exception\InvalidArgumentException | |
* @throws http\Exception\UnexpectedValueException | |
* @return http\Client self. | |
*/ | |
function enableEvents($enable = true) {} | |
/** | |
* Enable sending pipelined requests to the same host if the driver supports it. | |
* @param bool $enable Whether to enable pipelining. | |
* @throws http\Exception\InvalidArgumentException | |
* @throws http\Exception\UnexpectedValueException | |
* @return http\Client self. | |
*/ | |
function enablePipelining($enable = true) {} | |
/** | |
* Add another http\Client\Request to the request queue. | |
* @param http\Client\Request $request The request to enqueue. | |
* @param callable $cb A callback to automatically call when the request has finished. | |
* @throws http\Exception\InvalidArgumentException | |
* @throws http\Exception\BadMethodCallException | |
* @throws http\Exception\RuntimeException | |
* @return http\Client self. | |
*/ | |
function enqueue($request, $cb) {} | |
/** | |
* Get a list of available configuration options and their default values. | |
* @throws http\Exception\InvalidArgumentException | |
* @return array list of key/value pairs of available configuarion options and their default values. | |
*/ | |
function getAvailableConfiguration() {} | |
/** | |
* List available drivers. | |
* @return array list of supported drivers. | |
*/ | |
function getAvailableDrivers() {} | |
/** | |
* Retrieve a list of available request options and their default values. | |
* @throws http\Exception\InvalidArgumentException | |
* @return array list of key/value pairs of available request options and their default values. | |
*/ | |
function getAvailableOptions() {} | |
/** | |
* Get priorly set custom cookies. | |
* @return array custom cookies. | |
*/ | |
function getCookies() {} | |
/** | |
* Simply returns the http\Message chain representing the request/response history. | |
* @throws http\Exception\InvalidArgumentException | |
* @return http\Message the request/response message chain representing the client's history. | |
*/ | |
function getHistory() {} | |
/** | |
* Returns the SplObjectStorage holding attached observers. | |
* @throws http\Exception\InvalidArgumentException | |
* @throws http\Exception\UnexpectedValueException | |
* @return SplObjectStorage observer storage. | |
*/ | |
function getObservers() {} | |
/** | |
* Get priorly set options. | |
* @return array options. | |
*/ | |
function getOptions() {} | |
/** | |
* Retrieve the progress information for $request. | |
* @param http\Client\Request $request The request to retrieve the current progress information for. | |
* @throws http\Exception\InvalidArgumentException | |
* @throws http\Exception\UnexpectedValueException | |
* @return object|NULL stdClass instance holding progress information. or if $request is not enqueued. | |
*/ | |
function getProgressInfo($request) {} | |
/** | |
* Retrieve the corresponding reponse of an already finished request, or the last received response if $request is not set. | |
* @param http\Client\Request $request The request to fetch the stored response for. | |
* @throws http\Exception\InvalidArgumentException | |
* @throws http\Exception\UnexpectedValueException | |
* @return http\Client\Response|NULL the stored response for the request, or the last that was received. or if no more response was available to pop, when no $request was given. | |
*/ | |
function getResponse($request) {} | |
/** | |
* Retrieve priorly set SSL options. | |
* @return array SSL options. | |
*/ | |
function getSslOptions() {} | |
/** | |
* Get transfer related informatioin for a running or finished request. | |
* @param http\Client\Request $request The request to probe for transfer info. | |
* @throws http\Exception\InvalidArgumentException | |
* @throws http\Exception\UnexpectedValueException | |
* @return object stdClass instance holding transfer related information. | |
*/ | |
function getTransferInfo($request) {} | |
/** | |
* Implements SplSubject. Notify attached observers about progress with $request. | |
* @param http\Client\Request $request The request to notify about. | |
* @param object $progress stdClass instance holding progress information. | |
* @throws http\Exception\InvalidArgumentException | |
* @throws http\Exception\UnexpectedValueException | |
* @return http\Client self. | |
*/ | |
function notify($request = NULL, $progress = NULL) {} | |
/** | |
* Perform outstanding transfer actions. | |
* @return bool true if there are more transfers to complete. | |
*/ | |
function once() {} | |
/** | |
* Requeue an http\Client\Request. | |
* @param http\Client\Request $request The request to queue. | |
* @throws http\Exception\InvalidArgumentException | |
* @throws http\Exception\RuntimeException | |
* @return http\Client self. | |
*/ | |
function requeue($request) {} | |
/** | |
* Reset the client to the initial state. | |
* @return http\Client self. | |
*/ | |
function reset() {} | |
/** | |
* Send all enqueued requests. | |
* @throws http\Exception\InvalidArgumentException | |
* @throws http\Exception\RuntimeException | |
* @return http\Client self. | |
*/ | |
function send() {} | |
/** | |
* Set custom cookies. | |
* @param array $cookies Set the custom cookies to this array. | |
* @throws http\Exception\InvalidArgumentException | |
* @return http\Client self. | |
*/ | |
function setCookies($cookies = NULL) {} | |
/** | |
* Set client debugging callback. | |
* @param callable $callback | |
* @throws http\Exception\InvalidArgumentException | |
* @return http\Client self. | |
*/ | |
function setDebug($callback) {} | |
/** | |
* Set client options. | |
* @param array $options The options to set. | |
* @throws http\Exception\InvalidArgumentException | |
* @return http\Client self. | |
*/ | |
function setOptions($options = NULL) {} | |
/** | |
* Specifically set SSL options. | |
* @param array $ssl_options Set SSL options to this array. | |
* @throws http\Exception\InvalidArgumentException | |
* @return http\Client self. | |
*/ | |
function setSslOptions($ssl_options = NULL) {} | |
/** | |
* Wait for $timeout seconds for transfers to provide data. | |
* @param float $timeout Seconds to wait for data on open sockets. | |
* @return bool success. | |
*/ | |
function wait($timeout = 0) {} | |
} | |
/** | |
* A class representing a list of cookies with specific attributes. | |
*/ | |
class Cookie { | |
/** | |
* Do not decode cookie contents. | |
*/ | |
const PARSE_RAW = 1; | |
/** | |
* The cookies' flags have the secure attribute set. | |
*/ | |
const SECURE = 16; | |
/** | |
* The cookies' flags have the httpOnly attribute set. | |
*/ | |
const HTTPONLY = 32; | |
/** | |
* Create a new cookie list. | |
* @param mixed $cookies The string or list of cookies to parse or set. | |
* @param int $flags Parse flags. See http\Cookie::PARSE_* constants. | |
* @param array $allowed_extras List of extra attribute names to recognize. | |
* @throws http\Exception\InvalidArgumentException | |
* @throws http\Exception\RuntimeException | |
*/ | |
function __construct($cookies = NULL, $flags = 0, $allowed_extras = NULL) {} | |
/** | |
* String cast handler. Alias of http\Cookie::toString(). | |
* @return string the cookie(s) represented as string. | |
*/ | |
function __toString() {} | |
/** | |
* Add a cookie. | |
* @param string $cookie_name The key of the cookie. | |
* @param string $cookie_value The value of the cookie. | |
* @throws http\Exception\InvalidArgumentException | |
* @return http\Cookie self. | |
*/ | |
function addCookie($cookie_name, $cookie_value) {} | |
/** | |
* (Re)set the cookies. | |
* @param array $cookies Add cookies of this array of form ["name" => "value"]. | |
* @throws http\Exception\InvalidArgumentException | |
* @return http\Cookie self. | |
*/ | |
function addCookies($cookies) {} | |
/** | |
* Add an extra attribute to the cookie list. | |
* @param string $extra_name The key of the extra attribute. | |
* @param string $extra_value The value of the extra attribute. | |
* @throws http\Exception\InvalidArgumentException | |
* @return http\Cookie self. | |
*/ | |
function addExtra($extra_name, $extra_value) {} | |
/** | |
* Add several extra attributes. | |
* @param array $extras A list of extra attributes of the form ["key" => "value"]. | |
* @throws http\Exception\InvalidArgumentException | |
* @return http\Cookie self. | |
*/ | |
function addExtras($extras) {} | |
/** | |
* Retrieve a specific cookie value. | |
* @param string $cookie_name The key of the cookie to look up. | |
* @return string|NULL the cookie value. or if $cookie_name could not be found. | |
*/ | |
function getCookie($cookie_name) {} | |
/** | |
* Get the list of cookies. | |
* @return array the list of cookies of form ["name" => "value"]. | |
*/ | |
function getCookies() {} | |
/** | |
* Retrieve the effective domain of the cookie list. | |
* @return string the effective domain. | |
*/ | |
function getDomain() {} | |
/** | |
* Get the currently set expires attribute. | |
* @return int the currently set expires attribute as seconds since the epoch. | |
*/ | |
function getExpires() {} | |
/** | |
* Retrieve an extra attribute. | |
* @param string $name The key of the extra attribute. | |
* @return string the value of the extra attribute. | |
*/ | |
function getExtra($name) {} | |
/** | |
* Retrieve the list of extra attributes. | |
* @return array the list of extra attributes of the form ["key" => "value"]. | |
*/ | |
function getExtras() {} | |
/** | |
* Get the currently set flags. | |
* @return int the currently set flags bitmask. | |
*/ | |
function getFlags() {} | |
/** | |
* Get the currently set max-age attribute of the cookie list. | |
* @return int the currently set max-age. | |
*/ | |
function getMaxAge() {} | |
/** | |
* Retrieve the path the cookie(s) of this cookie list are effective at. | |
* @return string the effective path. | |
*/ | |
function getPath() {} | |
/** | |
* (Re)set a cookie. | |
* @param string $cookie_name The key of the cookie. | |
* @param string $cookie_value The value of the cookie. | |
* @throws http\Exception\InvalidArgumentException | |
* @return http\Cookie self. | |
*/ | |
function setCookie($cookie_name, $cookie_value) {} | |
/** | |
* (Re)set the cookies. | |
* @param array $cookies Set the cookies to this array. | |
* @throws http\Exception\InvalidArgumentException | |
* @return http\Cookie self. | |
*/ | |
function setCookies($cookies = NULL) {} | |
/** | |
* Set the effective domain of the cookie list. | |
* @param string $value The domain the cookie(s) belong to. | |
* @throws http\Exception\InvalidArgumentException | |
* @return http\Cookie self. | |
*/ | |
function setDomain($value = NULL) {} | |
/** | |
* Set the traditional expires timestamp. | |
* @param int $value The expires timestamp as seconds since the epoch. | |
* @throws http\Exception\InvalidArgumentException | |
* @return http\Cookie self. | |
*/ | |
function setExpires($value = -1) {} | |
/** | |
* (Re)set an extra attribute. | |
* @param string $extra_name The key of the extra attribute. | |
* @param string $extra_value The value of the extra attribute. | |
* @throws http\Exception\InvalidArgumentException | |
* @return http\Cookie self. | |
*/ | |
function setExtra($extra_name, $extra_value) {} | |
/** | |
* (Re)set the extra attributes. | |
* @param array $extras Set the extra attributes to this array. | |
* @throws http\Exception\InvalidArgumentException | |
* @return http\Cookie self. | |
*/ | |
function setExtras($extras = NULL) {} | |
/** | |
* Set the flags to specified $value. | |
* @param int $value The new flags bitmask. | |
* @throws http\Exception\InvalidArgumentException | |
* @return http\Cookie self. | |
*/ | |
function setFlags($value = 0) {} | |
/** | |
* Set the maximum age the cookie may have on the client side. | |
* @param int $value The max-age in seconds. | |
* @throws http\Exception\InvalidArgumentException | |
* @return http\Cookie self. | |
*/ | |
function setMaxAge($value = -1) {} | |
/** | |
* Set the path the cookie(s) of this cookie list should be effective at. | |
* @param string $path The URL path the cookie(s) should take effect within. | |
* @throws http\Exception\InvalidArgumentException | |
* @return http\Cookie self. | |
*/ | |
function setPath($path = NULL) {} | |
/** | |
* Get the cookie list as array. | |
* @return array the cookie list as array. | |
*/ | |
function toArray() {} | |
/** | |
* Retrieve the string representation of the cookie list. | |
* @return string the cookie list as string. | |
*/ | |
function toString() {} | |
} | |
/** | |
* | |
*/ | |
namespace http\Encoding; | |
namespace http; | |
/** | |
* The http\Env class provides static methods to manipulate and inspect the server's current request's HTTP environment. | |
*/ | |
class Env { | |
/** | |
* Retreive the current HTTP request's body. | |
* @throws http\Exception\InvalidArgumentException | |
* @throws http\Exception\UnexpectedValueException | |
* @return http\Message\Body instance representing the request body | |
*/ | |
function getRequestBody() {} | |
/** | |
* Retrieve one or all headers of the current HTTP request. | |
* @return NULL|string|array if $header_name was not found or the compound header when $header_name was found or of all headers if $header_name was not specified | |
*/ | |
function getRequestHeader() {} | |
/** | |
* Get the HTTP response code to send. | |
* @return int the HTTP response code. | |
*/ | |
function getResponseCode() {} | |
/** | |
* Get one or all HTTP response headers to be sent. | |
* @return string|NULL|array the compound value of the response header to send or if the header was not found or of all response headers, if $header_name was not specified | |
*/ | |
function getResponseHeader() {} | |
/** | |
* Retrieve a list of all known HTTP response status. | |
* @return array mapping of the form \[ | |
* ... | |
* int $code => string $status | |
* ... | |
* \] | |
*/ | |
function getResponseStatusForAllCodes() {} | |
/** | |
* Retrieve the string representation of specified HTTP response code. | |
* @return string|empty the HTTP response status message or string, if no message for this code was found | |
*/ | |
function getResponseStatusForCode() {} | |
/** | |
* Generic negotiator. For specific client negotiation see http\Env::negotiateContentType() and related methods. | |
* @param string $params HTTP header parameter's value to negotiate. | |
* @param array $supported List of supported negotiation operands. | |
* @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.). | |
* @return NULL|string if negotiation fails. or the closest match negotiated, or the default (first entry of $supported). | |
*/ | |
function negotiate($params, $supported, $prim_typ_sep) {} | |
/** | |
* Negotiate the client's preferred character set. | |
* @param array $supported List of supported content character sets. | |
* @return NULL|string if negotiation fails. or the negotiated character set. | |
*/ | |
function negotiateCharset($supported) {} | |
/** | |
* Negotiate the client's preferred MIME content type. | |
* @param array $supported List of supported MIME content types. | |
* @return NULL|string if negotiation fails. or the negotiated content type. | |
*/ | |
function negotiateContentType($supported) {} | |
/** | |
* Negotiate the client's preferred encoding. | |
* @param array $supported List of supported content encodings. | |
* @return NULL|string if negotiation fails. or the negotiated encoding. | |
*/ | |
function negotiateEncoding($supported) {} | |
/** | |
* Negotiate the client's preferred language. | |
* @param array $supported List of supported content languages. | |
* @return NULL|string if negotiation fails. or the negotiated language. | |
*/ | |
function negotiateLanguage($supported) {} | |
/** | |
* Set the HTTP response code to send. | |
* @param int $code The HTTP response status code. | |
* @return bool Success. | |
*/ | |
function setResponseCode($code) {} | |
/** | |
* Set a response header, either replacing a prior set header, or appending the new header value, depending on $replace. | |
* @return bool Success. | |
*/ | |
function setResponseHeader() {} | |
} | |
/** | |
* The http extension's Exception interface. | |
*/ | |
interface Exception { | |
} | |
/** | |
* The http\Header class provides methods to manipulate, match, negotiate and serialize HTTP headers. | |
*/ | |
class Header implements \Serializable { | |
/** | |
* None of the following match constraints applies. | |
*/ | |
const MATCH_LOOSE = 0; | |
/** | |
* Perform case sensitive matching. | |
*/ | |
const MATCH_CASE = 1; | |
/** | |
* Match only on word boundaries (according by CType alpha-numeric). | |
*/ | |
const MATCH_WORD = 16; | |
/** | |
* Match the complete string. | |
*/ | |
const MATCH_FULL = 32; | |
/** | |
* Case sensitively match the full string (same as MATCH_CASE|MATCH_FULL). | |
*/ | |
const MATCH_STRICT = 33; | |
/** | |
* The name of the HTTP header. | |
* @public | |
* @var string | |
*/ | |
public $name = NULL; | |
/** | |
* The value of the HTTP header. | |
* @public | |
* @var mixed | |
*/ | |
public $value = NULL; | |
/** | |
* 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. | |
* @param string $name The HTTP header name. | |
* @param mixed $value The value of the header. | |
* # Throws: | |
* * http\Exception | |
*/ | |
function __construct($name, $value) {} | |
/** | |
* String cast handler. Alias of http\Header::serialize(). | |
* @return string the serialized form of the HTTP header (i.e. "Name: value"). | |
*/ | |
function __toString() {} | |
/** | |
* Create a parameter list out of the HTTP header value. | |
* @param mixed $ps The parameter separator(s). | |
* @param mixed $as The argument separator(s). | |
* @param mixed $vs The value separator(s). | |
* @param int $flags The modus operandi. See http\Params constants. | |
* @return http\Params instance | |
*/ | |
function getParams($ps, $as, $vs, $flags) {} | |
/** | |
* Match the HTTP header's value against provided $value according to $flags. | |
* @param string $value The comparison value. | |
* @param int $flags The modus operandi. See http\Header constants. | |
* @return bool whether $value matches the header value according to $flags. | |
*/ | |
function match($value, $flags) {} | |
/** | |
* Negotiate the header's value against a list of supported values in $supported. | |
* @param array $supported The list of supported values to negotiate. | |
* @return NULL|string if negotiation fails. or the closest match negotiated, or the default (first entry of $supported). | |
*/ | |
function negotiate($supported) {} | |
/** | |
* Parse HTTP headers. | |
* @param string $header The complete string of headers. | |
* @param string $header_class A class extending http\Header. | |
* @return array|false of parsed headers, where the elements are instances of $header_class if specified. or if parsing fails. | |
*/ | |
function parse($header, $header_class) {} | |
/** | |
* Implements Serializable. | |
* @return string serialized representation of HTTP header (i.e. "Name: value") | |
*/ | |
function serialize() {} | |
/** | |
* Convenience method. Alias of http\Header::serialize(). | |
* @return string the serialized form of the HTTP header (i.e. "Name: value"). | |
*/ | |
function toString() {} | |
/** | |
* Implements Serializable. | |
* @param string $serialized The serialized HTTP header (i.e. "Name: value") | |
*/ | |
function unserialize($serialized) {} | |
} | |
/** | |
* The message class builds the foundation for any request and response message. | |
*/ | |
class Message implements \Countable, \Serializable, \Iterator { | |
/** | |
* No specific type of message. | |
*/ | |
const TYPE_NONE = 0; | |
/** | |
* A request message. | |
*/ | |
const TYPE_REQUEST = 1; | |
/** | |
* A response message. | |
*/ | |
const TYPE_RESPONSE = 2; | |
/** | |
* The message type. See http\Message::TYPE_* constants. | |
* @protected | |
* @var int | |
*/ | |
protected $type = http\Message::TYPE_NONE; | |
/** | |
* The message's body. | |
* @protected | |
* @var http\Message\Body | |
*/ | |
protected $body = NULL; | |
/** | |
* The request method if the message is of type request. | |
* @protected | |
* @var string | |
*/ | |
protected $requestMethod = ""; | |
/** | |
* The request url if the message is of type request. | |
* @protected | |
* @var string | |
*/ | |
protected $requestUrl = ""; | |
/** | |
* The respose status phrase if the message is of type response. | |
* @protected | |
* @var string | |
*/ | |
protected $responseStatus = ""; | |
/** | |
* The response code if the message is of type response. | |
* @protected | |
* @var int | |
*/ | |
protected $responseCode = 0; | |
/** | |
* A custom HTTP protocol version. | |
* @protected | |
* @var string | |
*/ | |
protected $httpVersion = NULL; | |
/** | |
* Any message headers. | |
* @protected | |
* @var array | |
*/ | |
protected $headers = NULL; | |
/** | |
* Any parent message. | |
* @protected | |
* @var http\Message | |
*/ | |
protected $parentMessage; | |
/** | |
* Create a new HTTP message. | |
* @param mixed $message Either a resource or a string, representing the HTTP message. | |
* @param bool $greedy Whether to read from a $message resource until EOF. | |
* @throws http\Exception\InvalidArgumentException | |
* @throws http\Exception\BadMessageException | |
*/ | |
function __construct($message = NULL, $greedy = true) {} | |
/** | |
* Retrieve the message serialized to a string. | |
* @return string the single serialized HTTP message. | |
*/ | |
function __toString() {} | |
/** | |
* Append the data of $body to the message's body. | |
* @param http\Message\Body $body The message body to add. | |
* @return http\Message self. | |
*/ | |
function addBody($body) {} | |
/** | |
* Add an header, appending to already existing headers. | |
* @param string $name The header name. | |
* @param mixed $value The header value. | |
* @return http\Message self. | |
*/ | |
function addHeader($name, $value) {} | |
/** | |
* Add headers, optionally appending values, if header keys already exist. | |
* @param array $headers The HTTP headers to add. | |
* @param bool $append Whether to append values for existing headers. | |
* @return http\Message self. | |
*/ | |
function addHeaders($headers, $append = false) {} | |
/** | |
* Implements Countable. | |
* @return int the count of messages in the chain above the current message. | |
*/ | |
function count() {} | |
/** | |
* Implements iterator. | |
* @return http\Message the current message in the iterated message chain. | |
*/ | |
function current() {} | |
/** | |
* Detach a clone of this message from any message chain. | |
* @throws http\Exception\InvalidArgumentException | |
* @return http\Message clone. | |
*/ | |
function detach() {} | |
/** | |
* Retrieve the message's body. | |
* @throws http\Exception\InvalidArgumentException | |
* @throws http\Exception\UnexpectedValueEcxeption | |
* @return http\Message\Body the message body. | |
*/ | |
function getBody() {} | |
/** | |
* Retrieve a single header, optionally hydrated into a http\Header extending class. | |
* @param string $header The header's name. | |
* @param string $into_class The name of a class extending http\Header. | |
* @return mixed|http\Header the header value if $into_class is NULL. or descendant. | |
*/ | |
function getHeader($header, $into_class = NULL) {} | |
/** | |
* Retrieve all message headers. | |
* @return array the message's headers. | |
*/ | |
function getHeaders() {} | |
/** | |
* Retreive the HTTP protocol version of the message. | |
* @return string the HTTP protocol version, e.g. "1.0"; defaults to "1.1". | |
*/ | |
function getHttpVersion() {} | |
/** | |
* Retrieve the first line of a request or response message. | |
*/ | |
function getInfo() {} | |
/** | |
* Retrieve any parent message. | |
* @throws http\Exception\InvalidArgumentException | |
* @throws http\Exception\BadMethodCallException | |
* @return http /Message, the parent message. | |
*/ | |
function getParentMessage() {} | |
/** | |
* Retrieve the request method of the message. | |
* @return string|false the request method. or if the message was not of type request. | |
*/ | |
function getRequestMethod() {} | |
/** | |
* Retrieve the request URL of the message. | |
* @return string|false the request URL; usually the path and the querystring. or if the message was not of type request. | |
*/ | |
function getRequestUrl() {} | |
/** | |
* Retrieve the response code of the message. | |
* @return int|false the response status code. or if the message is not of type response. | |
*/ | |
function getResponseCode() {} | |
/** | |
* Retrieve the response status of the message. | |
* @return string|false the response status phrase. or if the message is not of type response. | |
*/ | |
function getResponseStatus() {} | |
/** | |
* Retrieve the type of the message. | |
* @return int the message type. See http\Message::TYPE_* constants. | |
*/ | |
function getType() {} | |
/** | |
* Check whether this message is a multipart message based on it's content type. | |
* @return bool whether this is a message with a multipart "Content-Type". | |
*/ | |
function isMultipart() {} | |
/** | |
* Implements Iterator. | |
* @return int a non-sequential integer key. | |
*/ | |
function key() {} | |
/** | |
* Implements Iterator. | |
*/ | |
function next() {} | |
/** | |
* Prepend message(s) $message to this message, or the top most message of this message chain. | |
* @param http\Message $message The message (chain) to prepend as parent messages. | |
* @param bool $top Whether to prepend to the top-most parent message. | |
* @throws http\Exception\InvalidArgumentException | |
* @throws http\Exception\UnexpectedValueException | |
* @return http\Message self. | |
*/ | |
function prepend($message, $top = true) {} | |
/** | |
* Reverse the message chain and return the former top-most message. | |
* @throws http\Exception\InvalidArgumentException | |
* @return http\Message the other end of the message chain. | |
*/ | |
function reverse() {} | |
/** | |
* Implements Iterator. | |
*/ | |
function rewind() {} | |
/** | |
* Implements Serializable. | |
* @return string the serialized HTTP message. | |
*/ | |
function serialize() {} | |
/** | |
* Set the message's body. | |
* @param http\Message\Body $body The new message body. | |
* @throws http\Exception\InvalidArgumentException | |
* @throws http\Exception\UnexpectedValueException | |
* @return http\Message self. | |
*/ | |
function setBody($body) {} | |
/** | |
* Set a single header. | |
* @param string $header The header's name. | |
* @param mixed $value The header's value. Removes the header if NULL. | |
* @return http\Message self. | |
*/ | |
function setHeader($header, $value = NULL) {} | |
/** | |
* Set the message headers. | |
* @param array $headers The message's headers. | |
* @return http\Message null. | |
*/ | |
function setHeaders($headers = NULL) {} | |
/** | |
* Set the HTTP protocol version of the message. | |
* @param string $http_version The protocol version, e.g. "1.1", optionally prefixed by "HTTP/". | |
* @throws http\Exception\InvalidArgumentException | |
* @throws http\Exception\BadHeaderException | |
* @return http\Message self. | |
*/ | |
function setHttpVersion($http_version) {} | |
/** | |
* Set the complete message info, i.e. type and response resp. request information, at once. | |
* @param string $http_info The message info (first line of an HTTP message). | |
* @throws http\Exception\InvalidArgumentException | |
* @throws http\Exception\BadHeaderException | |
* @return http\Message self. | |
*/ | |
function setInfo($http_info) {} | |
/** | |
* Set the request method of the message. | |
* @param string $method The request method. | |
* @throws http\Exception\InvalidArgumentException | |
* @throws http\Exception\BadMethodCallException | |
* @return http\Message self. | |
*/ | |
function setRequestMethod($method) {} | |
/** | |
* Set the request URL of the message. | |
* @param string $url The request URL. | |
* @throws http\Exception\InvalidArgumentException | |
* @throws http\Exception\BadMethodCallException | |
* @return http\Message self. | |
*/ | |
function setRequestUrl($url) {} | |
/** | |
* Set the response status code. | |
* @param int $response_code The response code. | |
* @param bool $strict Whether to check that the response code is between 100 and 599 inclusive. | |
* @throws http\Exception\InvalidArgumentException | |
* @throws http\Exception\BadMethodCallException | |
* @return http\Message self. | |
*/ | |
function setResponseCode($response_code, $strict = true) {} | |
/** | |
* Set the response status phrase. | |
* @param string $response_status The status phrase. | |
* @throws http\Exception\InvalidArgumentException | |
* @throws http\Exception\BadMethodCallException | |
* @return http\Message self. | |
*/ | |
function setResponseStatus($response_status) {} | |
/** | |
* Set the message type and reset the message info. | |
* @param int $type The desired message type. See the http\Message::TYPE_* constants. | |
* @return http\Message self. | |
*/ | |
function setType($type) {} | |
/** | |
* Splits the body of a multipart message. | |
* @throws http\Exception\InvalidArgumentException | |
* @throws http\Exception\BadMethodCallException | |
* @throws http\Exception\BadMessageException | |
* @return http\Message a message chain of all messages of the multipart body. | |
*/ | |
function splitMultipartBody() {} | |
/** | |
* Stream the message through a callback. | |
* @param callable $callback The callback of the form function(http\Message $from, string $data). | |
* @param int $offset Start to stream from this offset. | |
* @param int $maxlen Stream at most $maxlen bytes, or all if $maxlen is less than 1. | |
* @return http\Message self. | |
*/ | |
function toCallback($callback, $offset = 0, $maxlen = 0) {} | |
/** | |
* Stream the message into stream $stream, starting from $offset, streaming $maxlen at most. | |
* @param resource $stream The resource to write to. | |
* @param int $offset The starting offset. | |
* @param int $maxlen The maximum amount of data to stream. All content if less than 1. | |
* @return http\Message self. | |
*/ | |
function toStream($stream, $offset = 0, $maxlen = 0) {} | |
/** | |
* Retrieve the message serialized to a string. | |
* @param bool $include_parent Whether to include all parent messages. | |
* @return string the HTTP message chain serialized to a string. | |
*/ | |
function toString($include_parent = false) {} | |
/** | |
* Implements Serializable. | |
* @param string $data The serialized message. | |
*/ | |
function unserialize($data) {} | |
/** | |
* Implements Iterator. | |
* @return bool whether http\Message::current() would not return NULL. | |
*/ | |
function valid() {} | |
} | |
/** | |
* Parse, interpret and compose HTTP (header) parameters. | |
*/ | |
class Params implements \ArrayAccess { | |
/** | |
* The default parameter separator (","). | |
*/ | |
const DEF_PARAM_SEP = ','; | |
/** | |
* The default argument separator (";"). | |
*/ | |
const DEF_ARG_SEP = ';'; | |
/** | |
* The default value separator ("="). | |
*/ | |
const DEF_VAL_SEP = '='; | |
/** | |
* Empty param separator to parse cookies. | |
*/ | |
const COOKIE_PARAM_SEP = ''; | |
/** | |
* Do not interpret the parsed parameters. | |
*/ | |
const PARSE_RAW = 0; | |
/** | |
* Interpret input as default formatted parameters. | |
*/ | |
const PARSE_DEFAULT = 17; | |
/** | |
* Urldecode single units of parameters, arguments and values. | |
*/ | |
const PARSE_URLENCODED = 4; | |
/** | |
* Parse sub dimensions indicated by square brackets. | |
*/ | |
const PARSE_DIMENSION = 8; | |
/** | |
* Parse URL querystring (same as http\Params::PARSE_URLENCODED|http\Params::PARSE_DIMENSION). | |
*/ | |
const PARSE_QUERY = 12; | |
/** | |
* Parse [RFC5987](http://tools.ietf.org/html/rfc5987) style encoded character set and language information embedded in HTTP header params. | |
*/ | |
const PARSE_RFC5987 = 16; | |
/** | |
* Parse [RFC5988](http://tools.ietf.org/html/rfc5988) (Web Linking) tags of Link headers. | |
*/ | |
const PARSE_RFC5988 = 32; | |
/** | |
* The (parsed) parameters. | |
* @public | |
* @var array | |
*/ | |
public $params = NULL; | |
/** | |
* The parameter separator(s). | |
* @public | |
* @var array | |
*/ | |
public $param_sep = http\Params::DEF_PARAM_SEP; | |
/** | |
* The argument separator(s). | |
* @public | |
* @var array | |
*/ | |
public $arg_sep = http\Params::DEF_ARG_SEP; | |
/** | |
* The value separator(s). | |
* @public | |
* @var array | |
*/ | |
public $val_sep = http\Params::DEF_VAL_SEP; | |
/** | |
* The modus operandi of the parser. See http\Params::PARSE_* constants. | |
* @public | |
* @var int | |
*/ | |
public $flags = http\Params::PARSE_DEFAULT; | |
/** | |
* Instantiate a new HTTP (header) parameter set. | |
* @param mixed $params Pre-parsed parameters or a string to be parsed. | |
* @param mixed $ps The parameter separator(s). | |
* @param mixed $as The argument separator(s). | |
* @param mixed $vs The value separator(s). | |
* @param int $flags The modus operandi. See http\Params::PARSE_* constants. | |
* @throws http\Exception\InvalidArgumentException | |
* @throws http\Exception\RuntimeException | |
*/ | |
function __construct($params, $ps, $as, $vs, $flags) {} | |
/** | |
* String cast handler. Alias of http\Params::toString(). | |
* @return string version of the parameters. | |
*/ | |
function __toString() {} | |
/** | |
* Implements ArrayAccess. | |
* @param string $name The offset to look after. | |
* @return bool Existence. | |
*/ | |
function offsetExists($name) {} | |
/** | |
* Implements ArrayAccess. | |
* @param string $name The offset to retrieve. | |
* @return mixed contents at offset. | |
*/ | |
function offsetGet($name) {} | |
/** | |
* Implements ArrayAccess. | |
* @param string $name The offset to modify. | |
* @param mixed $value The value to set. | |
*/ | |
function offsetSet($name, $value) {} | |
/** | |
* Implements ArrayAccess. | |
* @param string $name The offset to delete. | |
*/ | |
function offsetUnset($name) {} | |
/** | |
* Convenience method that simply returns http\Params::$params. | |
* @return array of paramters. | |
*/ | |
function toArray() {} | |
/** | |
* Returns a stringified version of the parameters. | |
* @return string version of the parameters. | |
*/ | |
function toString() {} | |
} | |
/** | |
* The http\QueryString class provides versatile facilities to retrieve, use and manipulate query strings and form data. | |
*/ | |
class QueryString implements \Serializable, \ArrayAccess, \IteratorAggregate { | |
/** | |
* Cast requested value to bool. | |
*/ | |
const TYPE_BOOL = 16; | |
/** | |
* Cast requested value to int. | |
*/ | |
const TYPE_INT = 4; | |
/** | |
* Cast requested value to float. | |
*/ | |
const TYPE_FLOAT = 5; | |
/** | |
* Cast requested value to string. | |
*/ | |
const TYPE_STRING = 6; | |
/** | |
* Cast requested value to an array. | |
*/ | |
const TYPE_ARRAY = 7; | |
/** | |
* Cast requested value to an object. | |
*/ | |
const TYPE_OBJECT = 8; | |
/** | |
* The global instance. See http\QueryString::getGlobalInstance(). | |
* @private | |
* @var http\QueryString | |
*/ | |
private $instance = NULL; | |
/** | |
* The data. | |
* @private | |
* @var array | |
*/ | |
private $queryArray = NULL; | |
/** | |
* Create an independent querystring instance. | |
* @param mixed $params The query parameters to use or parse. | |
* @throws http\Exception\BadQueryStringException | |
*/ | |
function __construct($params = NULL) {} | |
/** | |
* Retrieve an querystring value. | |
* @param string $name The key to retrieve the value for. | |
* @param mixed $type The type to cast the value to. See http\QueryString::TYPE_* constants. | |
* @param mixed $defval The default value to return if the key $name does not exist. | |
* @param bool $delete Whether to delete the entry from the querystring after retrieval. | |
* @return http\QueryString|string|mixed if called without arguments. or the whole querystring if $name is of zero length. or $defval if the key $name does not exist. or the querystring value cast to $type if $type was specified and the key $name exists. or the querystring value if the key $name exists and $type is not specified or equals http\QueryString::TYPE_STRING. | |
*/ | |
function get($name = NULL, $type = NULL, $defval = NULL, $delete = false) {} | |
/** | |
* Retrieve an array value with at offset $name. | |
* @param string $name The key to look up. | |
* @param mixed $defval The default value to return if the offset $name does not exist. | |
* @param bool $delete Whether to remove the key and value from the querystring after retrieval. | |
* @return array|mixed the (casted) value. or $defval if offset $name does not exist. | |
*/ | |
function getArray($name, $defval = NULL, $delete = false) {} | |
/** | |
* Retrieve a boolean value at offset $name. | |
* @param string $name The key to look up. | |
* @param mixed $defval The default value to return if the offset $name does not exist. | |
* @param bool $delete Whether to remove the key and value from the querystring after retrieval. | |
* @return bool|mixed the (casted) value. or $defval if offset $name does not exist. | |
*/ | |
function getBool($name, $defval = NULL, $delete = false) {} | |
/** | |
* Retrieve a float value at offset $name. | |
* @param string $name The key to look up. | |
* @param mixed $defval The default value to return if the offset $name does not exist. | |
* @param bool $delete Whether to remove the key and value from the querystring after retrieval. | |
* @return float|mixed the (casted) value. or $defval if offset $name does not exist. | |
*/ | |
function getFloat($name, $defval = NULL, $delete = false) {} | |
/** | |
* Retrieve the global querystring instance referencing $_GET. | |
* @throws http\Exception\UnexpectedValueException | |
* @return http\QueryString the http\QueryString::$instance | |
*/ | |
function getGlobalInstance() {} | |
/** | |
* Retrieve a int value at offset $name. | |
* @param string $name The key to look up. | |
* @param mixed $defval The default value to return if the offset $name does not exist. | |
* @param bool $delete Whether to remove the key and value from the querystring after retrieval. | |
* @return int|mixed the (casted) value. or $defval if offset $name does not exist. | |
*/ | |
function getInt($name, $defval = NULL, $delete = false) {} | |
/** | |
* Implements IteratorAggregate. | |
* @throws http\Exception\InvalidArgumentException | |
* @throws InvalidArgumentException | |
*/ | |
function getIterator() {} | |
/** | |
* Retrieve a object value with at offset $name. | |
* @param string $name The key to look up. | |
* @param mixed $defval The default value to return if the offset $name does not exist. | |
* @param bool $delete Whether to remove the key and value from the querystring after retrieval. | |
* @return object|mixed the (casted) value. or $defval if offset $name does not exist. | |
*/ | |
function getObject($name, $defval = NULL, $delete = false) {} | |
/** | |
* Retrieve a string value with at offset $name. | |
* @param string $name The key to look up. | |
* @param mixed $defval The default value to return if the offset $name does not exist. | |
* @param bool $delete Whether to remove the key and value from the querystring after retrieval. | |
* @return string|mixed the (casted) value. or $defval if offset $name does not exist. | |
*/ | |
function getString($name, $defval = NULL, $delete = false) {} | |
/** | |
* Set additional $params to a clone of this instance. | |
* @param mixed $params Additional params as object, array or string to parse. | |
* @throws http\Exception\BadQueryStringException | |
* @return http\QueryString clone. | |
*/ | |
function mod($params = NULL) {} | |
/** | |
* Implements ArrayAccess. | |
* @param string $name The offset to look up. | |
* @return bool whether the key $name isset. | |
*/ | |
function offsetExists($name) {} | |
/** | |
* Implements ArrayAccess. | |
* @param mixed $offset The offset to look up. | |
* @return mixed|NULL the value locate at offset $name. or if key $name could not be found. | |
*/ | |
function offsetGet($offset) {} | |
/** | |
* Implements ArrayAccess. | |
* @param string $name The key to set the value for. | |
* @param mixed $data The data to place at offset $name. | |
*/ | |
function offsetSet($name, $data) {} | |
/** | |
* Implements ArrayAccess. | |
* @param string $name The offset to look up. | |
*/ | |
function offsetUnset($name) {} | |
/** | |
* Implements Serializable. | |
* @return string the x-www-form-urlencoded querystring. | |
*/ | |
function serialize() {} | |
/** | |
* Set additional querystring entries. | |
* @param mixed $params Additional params as object, array or string to parse. | |
* @return http\QueryString self. | |
*/ | |
function set($params) {} | |
/** | |
* Simply returns http\QueryString::$queryArray. | |
* @return array the $queryArray property. | |
*/ | |
function toArray() {} | |
/** | |
* Get the string represenation of the querystring (x-www-form-urlencoded). | |
* @return string the x-www-form-urlencoded querystring. | |
*/ | |
function toString() {} | |
/** | |
* Implements Serializable. | |
* @param string $serialized The x-www-form-urlencoded querystring. | |
* @throws http\Exception | |
*/ | |
function unserialize($serialized) {} | |
/** | |
* Translate character encodings of the querystring with ext/iconv. | |
* @param string $from_enc The encoding to convert from. | |
* @param string $to_enc The encoding to convert to. | |
* @throws http\Exception\InvalidArgumentException | |
* @throws http\Exception\BadConversionException | |
* @return http\QueryString self. | |
*/ | |
function xlate($from_enc, $to_enc) {} | |
} | |
/** | |
* The http\Url class provides versatile means to parse, construct and manipulate URLs. | |
*/ | |
class Url { | |
/** | |
* Replace parts of the old URL with parts of the new. | |
*/ | |
const REPLACE = 0; | |
/** | |
* Whether a relative path should be joined into the old path. | |
*/ | |
const JOIN_PATH = 1; | |
/** | |
* Whether the querystrings should be joined. | |
*/ | |
const JOIN_QUERY = 2; | |
/** | |
* Strip the user information from the URL. | |
*/ | |
const STRIP_USER = 4; | |
/** | |
* Strip the password from the URL. | |
*/ | |
const STRIP_PASS = 8; | |
/** | |
* Strip user and password information from URL (same as STRIP_USER|STRIP_PASS). | |
*/ | |
const STRIP_AUTH = 12; | |
/** | |
* Do not include the port. | |
*/ | |
const STRIP_PORT = 32; | |
/** | |
* Do not include the URL path. | |
*/ | |
const STRIP_PATH = 64; | |
/** | |
* Do not include the URL querystring. | |
*/ | |
const STRIP_QUERY = 128; | |
/** | |
* Strip the fragment (hash) from the URL. | |
*/ | |
const STRIP_FRAGMENT = 256; | |
/** | |
* Strip everything except scheme and host information. | |
*/ | |
const STRIP_ALL = 492; | |
/** | |
* Import initial URL parts from the SAPI environment. | |
*/ | |
const FROM_ENV = 4096; | |
/** | |
* Whether to sanitize the URL path (consolidate double slashes, directory jumps etc.) | |
*/ | |
const SANITIZE_PATH = 8192; | |
/** | |
* Parse UTF-8 encododed multibyte sequences. | |
*/ | |
const PARSE_MBUTF8 = 131072; | |
/** | |
* Parse locale encoded multibyte sequences (on systems with wide character support). | |
*/ | |
const PARSE_MBLOC = 65536; | |
/** | |
* Parse and convert multibyte hostnames according to IDNA (with IDNA support). | |
*/ | |
const PARSE_TOIDN = 1048576; | |
/** | |
* Explicitly request IDNA2003 implementation if available (libidn, idnkit or ICU). | |
*/ | |
const PARSE_TOIDN_2003 = 9437184; | |
/** | |
* Explicitly request IDNA2008 implementation if available (libidn2, idnkit2 or ICU). | |
*/ | |
const PARSE_TOIDN_2008 = 5242880; | |
/** | |
* Percent encode multibyte sequences in the userinfo, path, query and fragment parts of the URL. | |
*/ | |
const PARSE_TOPCT = 2097152; | |
/** | |
* Continue parsing when encountering errors. | |
*/ | |
const IGNORE_ERRORS = 268435456; | |
/** | |
* Suppress errors/exceptions. | |
*/ | |
const SILENT_ERRORS = 536870912; | |
/** | |
* Standard flags used by default internally for e.g. http\Message::setRequestUrl(). | |
* Enables joining path and query, sanitizing path, multibyte/unicode, international domain names and transient percent encoding. | |
*/ | |
const STDFLAGS = 3350531; | |
/** | |
* The URL's scheme. | |
* @public | |
* @var string | |
*/ | |
public $scheme = NULL; | |
/** | |
* Authenticating user. | |
* @public | |
* @var string | |
*/ | |
public $user = NULL; | |
/** | |
* Authentication password. | |
* @public | |
* @var string | |
*/ | |
public $pass = NULL; | |
/** | |
* Hostname/domain. | |
* @public | |
* @var string | |
*/ | |
public $host = NULL; | |
/** | |
* Port. | |
* @public | |
* @var string | |
*/ | |
public $port = NULL; | |
/** | |
* URL path. | |
* @public | |
* @var string | |
*/ | |
public $path = NULL; | |
/** | |
* URL querystring. | |
* @public | |
* @var string | |
*/ | |
public $query = NULL; | |
/** | |
* URL fragment (hash). | |
* @public | |
* @var string | |
*/ | |
public $fragment = NULL; | |
/** | |
* Create an instance of an http\Url. | |
* @param mixed $old_url Initial URL parts. Either an array, object, http\Url instance or string to parse. | |
* @param mixed $new_url Overriding URL parts. Either an array, object, http\Url instance or string to parse. | |
* @param int $flags The modus operandi of constructing the url. See http\Url constants. | |
* @throws http\Exception\InvalidArgumentException | |
* @throws http\Exception\BadUrlException | |
*/ | |
function __construct($old_url = NULL, $new_url = NULL, $flags = 0) {} | |
/** | |
* String cast handler. Alias of http\Url::toString(). | |
* @return string the URL as string. | |
*/ | |
function __toString() {} | |
/** | |
* Clone this URL and apply $parts to the cloned URL. | |
* @param mixed $parts New URL parts. | |
* @param int $flags Modus operandi of URL construction. See http\Url constants. | |
* @throws http\Exception\InvalidArgumentException | |
* @throws http\Exception\BadUrlException | |
* @return http\Url clone. | |
*/ | |
function mod($parts, $flags = http\Url::JOIN_PATH|http\Url::JOIN_QUERY|http\Url::SANITIZE_PATH) {} | |
/** | |
* Retrieve the URL parts as array. | |
* @return array the URL parts. | |
*/ | |
function toArray() {} | |
/** | |
* Get the string prepresentation of the URL. | |
* @return string the URL as string. | |
*/ | |
function toString() {} | |
} | |
/** | |
* The http\Client\Curl namespace holds option value constants specific to the curl driver of the http\Client. | |
*/ | |
namespace http\Client\Curl; | |
/** | |
* Bitmask of available libcurl features. | |
* See http\Client\Curl\Features namespace. | |
*/ | |
const FEATURES = 4179869; | |
/** | |
* List of library versions of or linked into libcurl, | |
* e.g. "libcurl/7.50.0 OpenSSL/1.0.2h zlib/1.2.8 libidn/1.32 nghttp2/1.12.0". | |
* See http\Client\Curl\Versions namespace. | |
*/ | |
const VERSIONS = 'libcurl/7.64.0 OpenSSL/1.1.1a zlib/1.2.11 libidn2/2.1.1 libpsl/0.20.2 (+libidn2/2.1.1) libssh2/1.8.0 nghttp2/1.36.0'; | |
/** | |
* Use HTTP/1.0 protocol version. | |
*/ | |
const HTTP_VERSION_1_0 = 1; | |
/** | |
* Use HTTP/1.1 protocol version. | |
*/ | |
const HTTP_VERSION_1_1 = 2; | |
/** | |
* Use HTTP/2 protocol version. Available if libcurl is v7.33.0 or more recent and was built with nghttp2 support. | |
*/ | |
const HTTP_VERSION_2_0 = 3; | |
/** | |
* Use any HTTP protocol version. | |
*/ | |
const HTTP_VERSION_ANY = 0; | |
/** | |
* Use TLS v1.0 encryption. | |
*/ | |
const SSL_VERSION_TLSv1_0 = 4; | |
/** | |
* Use TLS v1.1 encryption. | |
*/ | |
const SSL_VERSION_TLSv1_1 = 5; | |
/** | |
* Use TLS v1.2 encryption. | |
*/ | |
const SSL_VERSION_TLSv1_2 = 6; | |
/** | |
* Use any TLS v1 encryption. | |
*/ | |
const SSL_VERSION_TLSv1 = 1; | |
/** | |
* Use SSL v2 encryption. | |
*/ | |
const SSL_VERSION_SSLv2 = 2; | |
/** | |
* Use SSL v3 encryption. | |
*/ | |
const SSL_VERSION_SSLv3 = 3; | |
/** | |
* Use any encryption. | |
*/ | |
const SSL_VERSION_ANY = 0; | |
/** | |
* 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. | |
*/ | |
const TLS_AUTH_SRP = NULL; | |
/** | |
* Use IPv4 resolver. | |
*/ | |
const IPRESOLVE_V4 = 1; | |
/** | |
* Use IPv6 resolver. | |
*/ | |
const IPRESOLVE_V6 = 2; | |
/** | |
* Use any resolver. | |
*/ | |
const IPRESOLVE_ANY = 0; | |
/** | |
* Use Basic authentication. | |
*/ | |
const AUTH_BASIC = 1; | |
/** | |
* Use Digest authentication. | |
*/ | |
const AUTH_DIGEST = 2; | |
/** | |
* Use IE (lower v7) quirks with Digest authentication. Available if libcurl is v7.19.3 or more recent. | |
*/ | |
const AUTH_DIGEST_IE = 16; | |
/** | |
* Use NTLM authentication. | |
*/ | |
const AUTH_NTLM = 8; | |
/** | |
* Use GSS-Negotiate authentication. | |
*/ | |
const AUTH_GSSNEG = 4; | |
/** | |
* Use HTTP Netgotiate authentication (SPNEGO, RFC4559). Available if libcurl is v7.38.0 or more recent. | |
*/ | |
const AUTH_SPNEGO = 4; | |
/** | |
* Use any authentication. | |
*/ | |
const AUTH_ANY = -17; | |
/** | |
* Use SOCKSv4 proxy protocol. | |
*/ | |
const PROXY_SOCKS4 = 4; | |
/** | |
* Use SOCKSv4a proxy protocol. | |
*/ | |
const PROXY_SOCKS4A = 5; | |
/** | |
* Use SOCKS5h proxy protocol. | |
*/ | |
const PROXY_SOCKS5_HOSTNAME = 5; | |
/** | |
* Use SOCKS5 proxy protoccol. | |
*/ | |
const PROXY_SOCKS5 = 5; | |
/** | |
* Use HTTP/1.1 proxy protocol. | |
*/ | |
const PROXY_HTTP = 0; | |
/** | |
* Use HTTP/1.0 proxy protocol. Available if libcurl is v7.19.4 or more recent. | |
*/ | |
const PROXY_HTTP_1_0 = 1; | |
/** | |
* Keep POSTing on 301 redirects. Available if libcurl is v7.19.1 or more recent. | |
*/ | |
const POSTREDIR_301 = 1; | |
/** | |
* Keep POSTing on 302 redirects. Available if libcurl is v7.19.1 or more recent. | |
*/ | |
const POSTREDIR_302 = 2; | |
/** | |
* Keep POSTing on 303 redirects. Available if libcurl is v7.19.1 or more recent. | |
*/ | |
const POSTREDIR_303 = 4; | |
/** | |
* Keep POSTing on any redirect. Available if libcurl is v7.19.1 or more recent. | |
*/ | |
const POSTREDIR_ALL = 7; | |
namespace http\Client; | |
/** | |
* The http\Client\Request class provides an HTTP message implementation tailored to represent a request message to be sent by the client. | |
*/ | |
class Request extends \http\Message { | |
/** | |
* Array of options for this request, which override client options. | |
* @protected | |
* @var array | |
*/ | |
protected $options = NULL; | |
/** | |
* Create a new client request message to be enqueued and sent by http\Client. | |
* @param string $meth The request method. | |
* @param string $url The request URL. | |
* @param array $headers HTTP headers. | |
* @param http\Message\Body $body Request body. | |
* @throws http\Exception\InvalidArgumentException | |
* @throws http\Exception\UnexpectedValueException | |
*/ | |
function __construct($meth = NULL, $url = NULL, $headers = NULL, $body = NULL) {} | |
/** | |
* Add querystring data. | |
* @param mixed $query_data Additional querystring data. | |
* @throws http\Exception\InvalidArgumentException | |
* @throws http\Exception\BadQueryStringException | |
* @return http\Client\Request self. | |
*/ | |
function addQuery($query_data) {} | |
/** | |
* Add specific SSL options. | |
* @param array $ssl_options Add this SSL options. | |
* @throws http\Client\InvalidArgumentException | |
* @return http\Client\Request self. | |
*/ | |
function addSslOptions($ssl_options = NULL) {} | |
/** | |
* Extract the currently set "Content-Type" header. | |
* @return string|NULL the currently set content type. or if no "Content-Type" header is set. | |
*/ | |
function getContentType() {} | |
/** | |
* Get priorly set options. | |
* @return array options. | |
*/ | |
function getOptions() {} | |
/** | |
* Retrieve the currently set querystring. | |
* @return string|NULL the currently set querystring. or if no querystring is set. | |
*/ | |
function getQuery() {} | |
/** | |
* Retrieve priorly set SSL options. | |
* @return array SSL options. | |
*/ | |
function getSslOptions() {} | |
/** | |
* Set the MIME content type of the request message. | |
* @param string $content_type The MIME type used as "Content-Type". | |
* @throws http\Exception\InvalidArgumentException | |
* @throws http\Exception\UnexpectedValueException | |
* @return http\Client\Request self. | |
*/ | |
function setContentType($content_type) {} | |
/** | |
* Set client options. | |
* @param array $options The options to set. | |
* @throws http\Client\InvalidArgumentException | |
* @return http\Client\Request self. | |
*/ | |
function setOptions($options = NULL) {} | |
/** | |
* (Re)set the querystring. | |
* @param mixed $query_data | |
* @throws http\Exception\InvalidArgumentException | |
* @throws http\Exception\BadQueryStringException | |
* @return http\Client\Request self. | |
*/ | |
function setQuery($query_data) {} | |
/** | |
* Specifically set SSL options. | |
* @param array $ssl_options Set SSL options to this array. | |
* @throws http\Client\InvalidArgumentException | |
* @return http\Client\Request self. | |
*/ | |
function setSslOptions($ssl_options = NULL) {} | |
} | |
/** | |
* The http\Client\Response class represents an HTTP message the client returns as answer from a server to an http\Client\Request. | |
*/ | |
class Response extends \http\Message { | |
/** | |
* Extract response cookies. | |
* @param int $flags Cookie parser flags. | |
* @param array $allowed_extras List of keys treated as extras. | |
* @return array list of http\Cookie instances. | |
*/ | |
function getCookies($flags = 0, $allowed_extras = NULL) {} | |
/** | |
* Retrieve transfer related information after the request has completed. | |
* @param string $name A key to retrieve out of the transfer info. | |
* @throws http\Exception\InvalidArgumentException | |
* @throws http\Exception\BadMethodCallException | |
* @throws http\Exception\UnexpectedValueException | |
* @return object|mixed stdClass instance with all transfer info if $name was not given. or the specific transfer info for $name. | |
*/ | |
function getTransferInfo($name = NULL) {} | |
} | |
namespace http\Client\Curl; | |
/** | |
* Interface to an user event loop implementation for http\Client::configure()'s $use_eventloop option. | |
*/ | |
interface User { | |
/** | |
* No action. | |
*/ | |
const POLL_NONE = 0; | |
/** | |
* Poll for read readiness. | |
*/ | |
const POLL_IN = 1; | |
/** | |
* Poll for write readiness. | |
*/ | |
const POLL_OUT = 2; | |
/** | |
* Poll for read/write readiness. | |
*/ | |
const POLL_INOUT = 3; | |
/** | |
* Stop polling for activity on this descriptor. | |
*/ | |
const POLL_REMOVE = 4; | |
/** | |
* Initialize the event loop. | |
* @param callable $run | |
*/ | |
function init($run); | |
/** | |
* Run the loop as long as it does not block. | |
*/ | |
function once(); | |
/** | |
* Run the loop. | |
*/ | |
function send(); | |
/** | |
* Register (or deregister) a socket watcher. | |
* @param resource $socket The socket descriptor to watch. | |
* @param int $poll http\Client\Curl\User::POLL_* constant. | |
*/ | |
function socket($socket, $poll); | |
/** | |
* Register a timeout watcher. | |
* @param int $timeout_ms Desired maximum timeout in milliseconds. | |
*/ | |
function timer($timeout_ms); | |
/** | |
* Wait/poll/select (block the loop) until events fire. | |
* @param int $timeout_ms Block for at most this milliseconds. | |
*/ | |
function wait($timeout_ms = null); | |
} | |
/** | |
* CURL feature constants. | |
*/ | |
namespace http\Client\Curl\Features; | |
/** | |
* Whether libcurl supports asynchronous domain name resolution. | |
*/ | |
const ASYNCHDNS = 128; | |
/** | |
* Whether libcurl supports the Generic Security Services Application Program Interface. Available if libcurl is v7.38.0 or more recent. | |
*/ | |
const GSSAPI = 131072; | |
/** | |
* Whether libcurl supports HTTP Generic Security Services negotiation. | |
*/ | |
const GSSNEGOTIATE = 32; | |
/** | |
* Whether libcurl supports the HTTP/2 protocol. Available if libcurl is v7.33.0 or more recent. | |
*/ | |
const HTTP2 = 65536; | |
/** | |
* Whether libcurl supports international domain names. | |
*/ | |
const IDN = 1024; | |
/** | |
* Whether libcurl supports IPv6. | |
*/ | |
const IPV6 = 1; | |
/** | |
* Whether libcurl supports the old Kerberos protocol. | |
*/ | |
const KERBEROS4 = 2; | |
/** | |
* Whether libcurl supports the more recent Kerberos v5 protocol. Available if libcurl is v7.40.0 or more recent. | |
*/ | |
const KERBEROS5 = 262144; | |
/** | |
* Whether libcurl supports large files. | |
*/ | |
const LARGEFILE = 512; | |
/** | |
* Whether libcurl supports gzip/deflate compression. | |
*/ | |
const LIBZ = 8; | |
/** | |
* Whether libcurl supports the NT Lan Manager authentication. | |
*/ | |
const NTLM = 16; | |
/** | |
* Whether libcurl supports NTLM delegation to a winbind helper. Available if libcurl is v7.22.0 or more recent. | |
*/ | |
const NTLM_WB = 32768; | |
/** | |
* Whether libcurl supports the Public Suffix List for cookie host handling. Available if libcurl is v7.47.0 or more recent. | |
*/ | |
const PSL = 1048576; | |
/** | |
* Whether libcurl supports the Simple and Protected GSSAPI Negotiation Mechanism. | |
*/ | |
const SPNEGO = 256; | |
/** | |
* Whether libcurl supports SSL/TLS protocols. | |
*/ | |
const SSL = 4; | |
/** | |
* Whether libcurl supports the Security Support Provider Interface. | |
*/ | |
const SSPI = 2048; | |
/** | |
* Whether libcurl supports TLS Secure Remote Password authentication. Available if libcurl is v7.21.4 or more recent. | |
*/ | |
const TLSAUTH_SRP = 16384; | |
/** | |
* Whether libcurl supports connections to unix sockets. Available if libcurl is v7.40.0 or more recent. | |
*/ | |
const UNIX_SOCKETS = 524288; | |
/** | |
* CURL version constants. | |
*/ | |
namespace http\Client\Curl\Versions; | |
/** | |
* Version string of libcurl, e.g. "7.50.0". | |
*/ | |
const CURL = '7.64.0'; | |
/** | |
* Version string of the SSL/TLS library, e.g. "OpenSSL/1.0.2h". | |
*/ | |
const SSL = 'OpenSSL/1.1.1a'; | |
/** | |
* Version string of the zlib compression library, e.g. "1.2.8". | |
*/ | |
const LIBZ = '1.2.11'; | |
/** | |
* Version string of the c-ares library, e.g. "1.11.0". | |
*/ | |
const ARES = NULL; | |
/** | |
* Version string of the IDN library, e.g. "1.32". | |
*/ | |
const IDN = NULL; | |
namespace http\Encoding; | |
/** | |
* Base class for encoding stream implementations. | |
*/ | |
abstract class Stream { | |
/** | |
* Do no intermittend flushes. | |
*/ | |
const FLUSH_NONE = 0; | |
/** | |
* Flush at appropriate transfer points. | |
*/ | |
const FLUSH_SYNC = 1048576; | |
/** | |
* Flush at each IO operation. | |
*/ | |
const FLUSH_FULL = 2097152; | |
/** | |
* Base constructor for encoding stream implementations. | |
* @param int $flags See http\Encoding\Stream and implementation specific constants. | |
* @throws http\Exception\InvalidArgumentException | |
* @throws http\Exception\RuntimeException | |
*/ | |
function __construct($flags = 0) {} | |
/** | |
* Check whether the encoding stream is already done. | |
* @return bool whether the encoding stream is completed. | |
*/ | |
function done() {} | |
/** | |
* Finish and reset the encoding stream. | |
* @return string any pending data. | |
*/ | |
function finish() {} | |
/** | |
* Flush the encoding stream. | |
* @return string any pending data. | |
*/ | |
function flush() {} | |
/** | |
* Update the encoding stream with more input. | |
* @param string $data The data to pass through the stream. | |
* @return string processed data. | |
*/ | |
function update($data) {} | |
} | |
namespace http\Encoding\Stream; | |
/** | |
* A stream decoding data encoded with chunked transfer encoding. | |
*/ | |
class Dechunk extends \http\Encoding\Stream { | |
/** | |
* Decode chunked encoded data. | |
* @param string $data The data to decode. | |
* @param int $decoded_len Out parameter with the length of $data that's been decoded. | |
* Should be ```strlen($data)``` if not truncated. | |
* @return string|false the decoded data. or the unencoded data. or the truncated decoded data. or if $data cannot be decoded. | |
*/ | |
function decode($data, $decoded_len = 0) {} | |
} | |
/** | |
* A deflate stream supporting deflate, zlib and gzip encodings. | |
*/ | |
class Deflate extends \http\Encoding\Stream { | |
/** | |
* Gzip encoding. RFC1952 | |
*/ | |
const TYPE_GZIP = 16; | |
/** | |
* Zlib encoding. RFC1950 | |
*/ | |
const TYPE_ZLIB = 0; | |
/** | |
* Deflate encoding. RFC1951 | |
*/ | |
const TYPE_RAW = 32; | |
/** | |
* Default compression level. | |
*/ | |
const LEVEL_DEF = 0; | |
/** | |
* Least compression level. | |
*/ | |
const LEVEL_MIN = 1; | |
/** | |
* Greatest compression level. | |
*/ | |
const LEVEL_MAX = 9; | |
/** | |
* Default compression strategy. | |
*/ | |
const STRATEGY_DEF = 0; | |
/** | |
* Filtered compression strategy. | |
*/ | |
const STRATEGY_FILT = 256; | |
/** | |
* Huffman strategy only. | |
*/ | |
const STRATEGY_HUFF = 512; | |
/** | |
* Run-length encoding strategy. | |
*/ | |
const STRATEGY_RLE = 768; | |
/** | |
* Encoding with fixed Huffman codes only. | |
* > **A note on the compression strategy:** | |
* > | |
* > The strategy parameter is used to tune the compression algorithm. | |
* > | |
* > 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). | |
* > | |
* > 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. | |
* > | |
* > RLE is designed to be almost as fast as HUFFMAN_ONLY, but give better compression for PNG image data. | |
* > | |
* > FIXED prevents the use of dynamic Huffman codes, allowing for a simpler decoder for special applications. | |
* > | |
* > The strategy parameter only affects the compression ratio but not the correctness of the compressed output even if it is not set appropriately. | |
* > | |
* >_Source: [zlib Manual](http://www.zlib.net/manual.html)_ | |
*/ | |
const STRATEGY_FIXED = 1024; | |
/** | |
* Encode data with deflate/zlib/gzip encoding. | |
* @param string $data The data to compress. | |
* @param int $flags Any compression tuning flags. See http\Encoding\Stream\Deflate and http\Encoding\Stream constants. | |
* @return string the compressed data. | |
*/ | |
function encode($data, $flags = 0) {} | |
} | |
/** | |
* A inflate stream supporting deflate, zlib and gzip encodings. | |
*/ | |
class Inflate extends \http\Encoding\Stream { | |
/** | |
* Decode deflate/zlib/gzip encoded data. | |
* @param string $data The data to uncompress. | |
* @return string the uncompressed data. | |
*/ | |
function decode($data) {} | |
} | |
namespace http\Env; | |
/** | |
* The http\Env\Request class' instances represent the server's current HTTP request. | |
*/ | |
class Request extends \http\Message { | |
/** | |
* The request's query parameters. ($_GET) | |
* @protected | |
* @var http\QueryString | |
*/ | |
protected $query = NULL; | |
/** | |
* The request's form parameters. ($_POST) | |
* @protected | |
* @var http\QueryString | |
*/ | |
protected $form = NULL; | |
/** | |
* The request's form uploads. ($_FILES) | |
* @protected | |
* @var array | |
*/ | |
protected $files = NULL; | |
/** | |
* The request's cookies. ($_COOKIE) | |
* @protected | |
* @var array | |
*/ | |
protected $cookie = NULL; | |
/** | |
* Create an instance of the server's current HTTP request. | |
* @throws http\Exception\InvalidArgumentException | |
* @throws http\Exception\UnexpectedValueException | |
*/ | |
function __construct() {} | |
/** | |
* Retrieve an URL query value ($_GET). | |
* @param string $name The key to retrieve the value for. | |
* @param mixed $type The type to cast the value to. See http\QueryString::TYPE_* constants. | |
* @param mixed $defval The default value to return if the key $name does not exist. | |
* @param bool $delete Whether to delete the entry from the querystring after retrieval. | |
* @return http\QueryString|string|mixed if called without arguments. or the whole querystring if $name is of zero length. or $defval if the key $name does not exist. or the querystring value cast to $type if $type was specified and the key $name exists. or the querystring value if the key $name exists and $type is not specified or equals http\QueryString::TYPE_STRING. | |
*/ | |
function getCookie($name = NULL, $type = NULL, $defval = NULL, $delete = false) {} | |
/** | |
* Retrieve the uploaded files list ($_FILES). | |
* @return array the consolidated upload files array. | |
*/ | |
function getFiles() {} | |
/** | |
* Retrieve a form value ($_POST). | |
* @param string $name The key to retrieve the value for. | |
* @param mixed $type The type to cast the value to. See http\QueryString::TYPE_* constants. | |
* @param mixed $defval The default value to return if the key $name does not exist. | |
* @param bool $delete Whether to delete the entry from the querystring after retrieval. | |
* @return http\QueryString|string|mixed if called without arguments. or the whole querystring if $name is of zero length. or $defval if the key $name does not exist. or the querystring value cast to $type if $type was specified and the key $name exists. or the querystring value if the key $name exists and $type is not specified or equals http\QueryString::TYPE_STRING. | |
*/ | |
function getForm($name = NULL, $type = NULL, $defval = NULL, $delete = false) {} | |
/** | |
* Retrieve an URL query value ($_GET). | |
* @param string $name The key to retrieve the value for. | |
* @param mixed $type The type to cast the value to. See http\QueryString::TYPE_* constants. | |
* @param mixed $defval The default value to return if the key $name does not exist. | |
* @param bool $delete Whether to delete the entry from the querystring after retrieval. | |
* @return http\QueryString|string|mixed if called without arguments. or the whole querystring if $name is of zero length. or $defval if the key $name does not exist. or the querystring value cast to $type if $type was specified and the key $name exists. or the querystring value if the key $name exists and $type is not specified or equals http\QueryString::TYPE_STRING. | |
*/ | |
function getQuery($name = NULL, $type = NULL, $defval = NULL, $delete = false) {} | |
} | |
/** | |
* The http\Env\Response class' instances represent the server's current HTTP response. | |
*/ | |
class Response extends \http\Message { | |
/** | |
* Do not use content encoding. | |
*/ | |
const CONTENT_ENCODING_NONE = 0; | |
/** | |
* Support "Accept-Encoding" requests with gzip and deflate encoding. | |
*/ | |
const CONTENT_ENCODING_GZIP = 1; | |
/** | |
* No caching info available. | |
*/ | |
const CACHE_NO = 0; | |
/** | |
* The cache was hit. | |
*/ | |
const CACHE_HIT = 1; | |
/** | |
* The cache was missed. | |
*/ | |
const CACHE_MISS = 2; | |
/** | |
* A request instance which overrides the environments default request. | |
* @protected | |
* @var http\Env\Request | |
*/ | |
protected $request = NULL; | |
/** | |
* The response's MIME content type. | |
* @protected | |
* @var string | |
*/ | |
protected $contentType = NULL; | |
/** | |
* The response's MIME content disposition. | |
* @protected | |
* @var string | |
*/ | |
protected $contentDisposition = NULL; | |
/** | |
* See http\Env\Response::CONTENT_ENCODING_* constants. | |
* @protected | |
* @var int | |
*/ | |
protected $contentEncoding = NULL; | |
/** | |
* How the client should treat this response in regards to caching. | |
* @protected | |
* @var string | |
*/ | |
protected $cacheControl = NULL; | |
/** | |
* A custom ETag. | |
* @protected | |
* @var string | |
*/ | |
protected $etag = NULL; | |
/** | |
* A "Last-Modified" time stamp. | |
* @protected | |
* @var int | |
*/ | |
protected $lastModified = NULL; | |
/** | |
* Any throttling delay. | |
* @protected | |
* @var int | |
*/ | |
protected $throttleDelay = NULL; | |
/** | |
* The chunk to send every $throttleDelay seconds. | |
* @protected | |
* @var int | |
*/ | |
protected $throttleChunk = NULL; | |
/** | |
* The response's cookies. | |
* @protected | |
* @var array | |
*/ | |
protected $cookies = NULL; | |
/** | |
* Create a new env response message instance. | |
* @throws http\Exception\InvalidArgumentException | |
* @throws http\Exception\UnexpectedValueException | |
*/ | |
function __construct() {} | |
/** | |
* Output buffer handler. | |
* @param string $data The data output. | |
* @param int $ob_flags Output buffering flags passed from the output buffering control layer. | |
* @return bool success. | |
*/ | |
function __invoke($data, $ob_flags = 0) {} | |
/** | |
* Manually test the header $header_name of the environment's request for a cache hit. | |
* @param string $header_name The request header to test. | |
* @return int a http\Env\Response::CACHE_* constant. | |
*/ | |
function isCachedByEtag($header_name = "If-None-Match") {} | |
/** | |
* Manually test the header $header_name of the environment's request for a cache hit. | |
* @param string $header_name The request header to test. | |
* @return int a http\Env\Response::CACHE_* constant. | |
*/ | |
function isCachedByLastModified($header_name = "If-Modified-Since") {} | |
/** | |
* Send the response through the SAPI or $stream. | |
* @param resource $stream A writable stream to send the response through. | |
* @return bool success. | |
*/ | |
function send($stream = NULL) {} | |
/** | |
* Make suggestions to the client how it should cache the response. | |
* @param string $cache_control (A) "Cache-Control" header value(s). | |
* @throws http\Exception\InvalidArgumentException | |
* @return http\Env\Response self. | |
*/ | |
function setCacheControl($cache_control) {} | |
/** | |
* Set the reponse's content disposition parameters. | |
* @param array $disposition_params MIME content disposition as http\Params array. | |
* @throws http\Exception\InvalidArgumentException | |
* @return http\Env\Response self. | |
*/ | |
function setContentDisposition($disposition_params) {} | |
/** | |
* Enable support for "Accept-Encoding" requests with deflate or gzip. | |
* @param int $content_encoding See http\Env\Response::CONTENT_ENCODING_* constants. | |
* @throws http\Exception\InvalidArgumentException | |
* @return http\Env\Response self. | |
*/ | |
function setContentEncoding($content_encoding) {} | |
/** | |
* Set the MIME content type of the response. | |
* @param string $conten_type The response's content type. | |
* @throws http\Env\InvalidArgumentException | |
* @return http\Env\Response self. | |
*/ | |
function setContentType($conten_type) {} | |
/** | |
* Add cookies to the response to send. | |
* @param mixed $cookie The cookie to send. | |
* @throws http\Exception\InvalidArgumentException | |
* @throws http\Exception\UnexpectedValueException | |
* @return http\Env\Response self. | |
*/ | |
function setCookie($cookie) {} | |
/** | |
* Override the environment's request. | |
* @param http\Message $env_request The overriding request message. | |
* @throws http\Exception\InvalidArgumentException | |
* @return http\Env\Response self. | |
*/ | |
function setEnvRequest($env_request) {} | |
/** | |
* Set a custom ETag. | |
* @param string $etag A ETag. | |
* @throws http\Exception\InvalidArgumentException | |
* @return http\Env\Response self. | |
*/ | |
function setEtag($etag) {} | |
/** | |
* Set a custom last modified time stamp. | |
* @param int $last_modified A unix timestamp. | |
* @throws http\Exception\InvalidArgumentException | |
* @return http\Env\Response self. | |
*/ | |
function setLastModified($last_modified) {} | |
/** | |
* Enable throttling. | |
* @param int $chunk_size Bytes to send. | |
* @param float $delay Seconds to sleep. | |
* @return http\Env\Response self. | |
*/ | |
function setThrottleRate($chunk_size, $delay = 1) {} | |
} | |
/** | |
* URL class using the HTTP environment by default. | |
*/ | |
class Url extends \http\Url { | |
} | |
namespace http\Exception; | |
/** | |
* A bad conversion (e.g. character conversion) was encountered. | |
*/ | |
class BadConversionException extends \DomainException implements \http\Exception { | |
} | |
/** | |
* A bad HTTP header was encountered. | |
*/ | |
class BadHeaderException extends \DomainException implements \http\Exception { | |
} | |
/** | |
* A bad HTTP message was encountered. | |
*/ | |
class BadMessageException extends \DomainException implements \http\Exception { | |
} | |
/** | |
* A method was called on an object, which was in an invalid or unexpected state. | |
*/ | |
class BadMethodCallException extends \BadMethodCallException implements \http\Exception { | |
} | |
/** | |
* A bad querystring was encountered. | |
*/ | |
class BadQueryStringException extends \DomainException implements \http\Exception { | |
} | |
/** | |
* A bad HTTP URL was encountered. | |
*/ | |
class BadUrlException extends \DomainException implements \http\Exception { | |
} | |
/** | |
* One or more invalid arguments were passed to a method. | |
*/ | |
class InvalidArgumentException extends \InvalidArgumentException implements \http\Exception { | |
} | |
/** | |
* A generic runtime exception. | |
*/ | |
class RuntimeException extends \RuntimeException implements \http\Exception { | |
} | |
/** | |
* An unexpected value was encountered. | |
*/ | |
class UnexpectedValueException extends \UnexpectedValueException implements \http\Exception { | |
} | |
namespace http\Header; | |
/** | |
* The parser which is underlying http\Header and http\Message. | |
*/ | |
class Parser { | |
/** | |
* Finish up parser at end of (incomplete) input. | |
*/ | |
const CLEANUP = 1; | |
/** | |
* Parse failure. | |
*/ | |
const STATE_FAILURE = -1; | |
/** | |
* Expecting HTTP info (request/response line) or headers. | |
*/ | |
const STATE_START = 0; | |
/** | |
* Expecting a key or already parsing a key. | |
*/ | |
const STATE_KEY = 1; | |
/** | |
* Expecting a value or already parsing the value. | |
*/ | |
const STATE_VALUE = 2; | |
/** | |
* At EOL of an header, checking whether a folded header line follows. | |
*/ | |
const STATE_VALUE_EX = 3; | |
/** | |
* A header was completed. | |
*/ | |
const STATE_HEADER_DONE = 4; | |
/** | |
* Finished parsing the headers. | |
* > ***NOTE:*** | |
* > Most of this states won't be returned to the user, because the parser immediately jumps to the next expected state. | |
*/ | |
const STATE_DONE = 5; | |
/** | |
* Retrieve the current state of the parser. | |
* @throws http\Exception\InvalidArgumentException | |
* @return int http\Header\Parser::STATE_* constant. | |
*/ | |
function getState() {} | |
/** | |
* Parse a string. | |
* @param string $data The (part of the) header to parse. | |
* @param int $flags Any combination of [parser flags](http/Header/Parser#Parser.flags:). | |
* @throws http\Exception\InvalidArgumentException | |
* @return int http\Header\Parser::STATE_* constant. | |
*/ | |
function parse($data, $flags) {} | |
/** | |
* Parse a stream. | |
* @param stream $resource The header stream to parse from. | |
* @param int $flags Any combination of [parser flags](http/Header/Parser#Parser.flags:). | |
* @throws http\Exception\InvalidArgumentException | |
* @throws http\Exception\UnexpectedValueException | |
* @return int http\Header\Parser::STATE_* constant. | |
*/ | |
function stream($resource, $flags) {} | |
} | |
namespace http\Message; | |
/** | |
* The message body, represented as a PHP (temporary) stream. | |
*/ | |
class Body implements \Serializable { | |
/** | |
* Create a new message body, optionally referencing $stream. | |
* @param resource $stream A stream to be used as message body. | |
* @throws http\Exception\InvalidArgumentException | |
* @throws http\Exception\UnexpectedValueException | |
*/ | |
function __construct($stream = NULL) {} | |
/** | |
* String cast handler. | |
* @return string the message body. | |
*/ | |
function __toString() {} | |
/** | |
* Add form fields and files to the message body. | |
* @param array $fields List of form fields to add. | |
* * array $files = NULL | |
* List of form files to add. | |
* $fields must look like: | |
* [ | |
* "field_name" => "value", | |
* "multi_field" => [ | |
* "value1", | |
* "value2" | |
* ] | |
* ] | |
* $files must look like: | |
* [ | |
* [ | |
* "name" => "field_name", | |
* "type" => "content/type", | |
* "file" => "/path/to/file.ext" | |
* ], [ | |
* "name" => "field_name2", | |
* "type" => "text/plain", | |
* "file" => "file.ext", | |
* "data" => "string" | |
* ], [ | |
* "name" => "field_name3", | |
* "type" => "image/jpeg", | |
* "file" => "file.ext", | |
* "data" => fopen("/home/mike/Pictures/mike.jpg","r") | |
* ] | |
* 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. | |
* @throws http\Exception\InvalidArgumentException | |
* @throws http\Exception\RuntimeException | |
* @return http\Message\Body self. | |
*/ | |
function addForm($fields = NULL) {} | |
/** | |
* Add a part to a multipart body. | |
* @param http\Message $part The message part. | |
* @throws http\Exception\InvalidArgumentException | |
* @throws http\Exception\RuntimeException | |
* @return http\Message\Body self. | |
*/ | |
function addPart($part) {} | |
/** | |
* Append plain bytes to the message body. | |
* @param string $data The data to append to the body. | |
* @throws http\Exception\InvalidArgumentException | |
* @throws http\Exception\RuntimeException | |
* @return http\Message\Body self. | |
*/ | |
function append($data) {} | |
/** | |
* Retrieve the ETag of the body. | |
* @return string|false an Apache style ETag of inode, mtime and size in hex concatenated by hyphens if the message body stream is stat-able. or a content hash (which algorithm is determined by INI http.etag.mode) if the stream is not stat-able. or if http.etag.mode is not a known hash algorithm. | |
*/ | |
function etag() {} | |
/** | |
* Retrieve any boundary of the message body. | |
* @return string|NULL the message body boundary. or if this message body has no boundary. | |
*/ | |
function getBoundary() {} | |
/** | |
* Retrieve the underlying stream resource. | |
* @return resource the underlying stream. | |
*/ | |
function getResource() {} | |
/** | |
* Implements Serializable. | |
* @return string serialized message body. | |
*/ | |
function serialize() {} | |
/** | |
* Stat size, atime, mtime and/or ctime. | |
* @param string $field A single stat field to retrieve. | |
* @return int|object the requested stat field. or stdClass instance holding all four stat fields. | |
*/ | |
function stat($field = NULL) {} | |
/** | |
* Stream the message body through a callback. | |
* @param callable $callback The callback of the form function(http\Message\Body $from, string $data). | |
* @param int $offset Start to stream from this offset. | |
* @param int $maxlen Stream at most $maxlen bytes, or all if $maxlen is less than 1. | |
* @return http\Message\Body self. | |
*/ | |
function toCallback($callback, $offset = 0, $maxlen = 0) {} | |
/** | |
* Stream the message body into antother stream $stream, starting from $offset, streaming $maxlen at most. | |
* @param resource $stream The resource to write to. | |
* @param int $offset The starting offset. | |
* @param int $maxlen The maximum amount of data to stream. All content if less than 1. | |
* @return http\Message\Body self. | |
*/ | |
function toStream($stream, $offset = 0, $maxlen = 0) {} | |
/** | |
* Retrieve the message body serialized to a string. | |
* @return string message body. | |
*/ | |
function toString() {} | |
/** | |
* Implements Serializable. | |
* @param string $serialized The serialized message body. | |
*/ | |
function unserialize($serialized) {} | |
} | |
/** | |
* The parser which is underlying http\Message. | |
*/ | |
class Parser { | |
/** | |
* Finish up parser at end of (incomplete) input. | |
*/ | |
const CLEANUP = 1; | |
/** | |
* Soak up the rest of input if no entity length is deducible. | |
*/ | |
const DUMB_BODIES = 2; | |
/** | |
* Redirect messages do not contain any body despite of indication of such. | |
*/ | |
const EMPTY_REDIRECTS = 4; | |
/** | |
* Continue parsing while input is available. | |
*/ | |
const GREEDY = 8; | |
/** | |
* Parse failure. | |
*/ | |
const STATE_FAILURE = -1; | |
/** | |
* Expecting HTTP info (request/response line) or headers. | |
*/ | |
const STATE_START = 0; | |
/** | |
* Parsing headers. | |
*/ | |
const STATE_HEADER = 1; | |
/** | |
* Completed parsing headers. | |
*/ | |
const STATE_HEADER_DONE = 2; | |
/** | |
* Parsing the body. | |
*/ | |
const STATE_BODY = 3; | |
/** | |
* Soaking up all input as body. | |
*/ | |
const STATE_BODY_DUMB = 4; | |
/** | |
* Reading body as indicated by `Content-Lenght` or `Content-Range`. | |
*/ | |
const STATE_BODY_LENGTH = 5; | |
/** | |
* Parsing `chunked` encoded body. | |
*/ | |
const STATE_BODY_CHUNKED = 6; | |
/** | |
* Finished parsing the body. | |
*/ | |
const STATE_BODY_DONE = 7; | |
/** | |
* Finished parsing the message. | |
* > ***NOTE:*** | |
* > Most of this states won't be returned to the user, because the parser immediately jumps to the next expected state. | |
*/ | |
const STATE_DONE = 9; | |
/** | |
* Retrieve the current state of the parser. | |
* @throws http\Exception\InvalidArgumentException | |
* @return int http\Message\Parser::STATE_* constant. | |
*/ | |
function getState() {} | |
/** | |
* Parse a string. | |
* @param string $data The (part of the) message to parse. | |
* @param int $flags Any combination of [parser flags](http/Message/Parser#Parser.flags:). | |
* @throws http\Exception\InvalidArgumentException | |
* @return int http\Message\Parser::STATE_* constant. | |
*/ | |
function parse($data, $flags) {} | |
/** | |
* Parse a stream. | |
* @param stream $resource The message stream to parse from. | |
* @param int $flags Any combination of [parser flags](http/Message/Parser#Parser.flags:). | |
* @throws http\Exception\InvalidArgumentException | |
* @throws http\Exception\UnexpectedValueException | |
* @return int http\Message\Parser::STATE_* constant. | |
*/ | |
function stream($resource, $flags) {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment