StreamHandler
in package
HTTP handler that uses PHP's HTTP stream wrapper.
Tags
Table of Contents
Properties
- $lastHeaders : array<string|int, mixed>
Methods
- __invoke() : PromiseInterface
- Sends an HTTP request.
- add_cert() : void
- add_crypto_method() : void
- add_debug() : void
- add_progress() : void
- add_proxy() : void
- add_timeout() : void
- add_verify() : void
- addNotification() : void
- callArray() : callable
- checkDecode() : array<string|int, mixed>
- createResource() : resource
- Create a resource and check to ensure it was created successfully
- createResponse() : PromiseInterface
- createSink() : StreamInterface
- createStream() : resource
- drain() : StreamInterface
- Drains the source stream into the "sink" client option.
- getDefaultContext() : array<string|int, mixed>
- invokeStats() : void
- parse_proxy() : array<string|int, mixed>
- Parses the given proxy URL to make it compatible with the format PHP's stream context expects.
- resolveHost() : UriInterface
Properties
$lastHeaders
private
array<string|int, mixed>
$lastHeaders
= []
Methods
__invoke()
Sends an HTTP request.
public
__invoke(RequestInterface $request, array<string|int, mixed> $options) : PromiseInterface
Parameters
- $request : RequestInterface
-
Request to send.
- $options : array<string|int, mixed>
-
Request transfer options.
Return values
PromiseInterfaceadd_cert()
private
add_cert(RequestInterface $request, array<string|int, mixed> &$options, mixed $value, array<string|int, mixed> &$params) : void
Parameters
- $request : RequestInterface
- $options : array<string|int, mixed>
- $value : mixed
-
as passed via Request transfer options.
- $params : array<string|int, mixed>
add_crypto_method()
private
add_crypto_method(RequestInterface $request, array<string|int, mixed> &$options, mixed $value, array<string|int, mixed> &$params) : void
Parameters
- $request : RequestInterface
- $options : array<string|int, mixed>
- $value : mixed
-
as passed via Request transfer options.
- $params : array<string|int, mixed>
add_debug()
private
add_debug(RequestInterface $request, array<string|int, mixed> &$options, mixed $value, array<string|int, mixed> &$params) : void
Parameters
- $request : RequestInterface
- $options : array<string|int, mixed>
- $value : mixed
-
as passed via Request transfer options.
- $params : array<string|int, mixed>
add_progress()
private
add_progress(RequestInterface $request, array<string|int, mixed> &$options, mixed $value, array<string|int, mixed> &$params) : void
Parameters
- $request : RequestInterface
- $options : array<string|int, mixed>
- $value : mixed
-
as passed via Request transfer options.
- $params : array<string|int, mixed>
add_proxy()
private
add_proxy(RequestInterface $request, array<string|int, mixed> &$options, mixed $value, array<string|int, mixed> &$params) : void
Parameters
- $request : RequestInterface
- $options : array<string|int, mixed>
- $value : mixed
-
as passed via Request transfer options.
- $params : array<string|int, mixed>
add_timeout()
private
add_timeout(RequestInterface $request, array<string|int, mixed> &$options, mixed $value, array<string|int, mixed> &$params) : void
Parameters
- $request : RequestInterface
- $options : array<string|int, mixed>
- $value : mixed
-
as passed via Request transfer options.
- $params : array<string|int, mixed>
add_verify()
private
add_verify(RequestInterface $request, array<string|int, mixed> &$options, mixed $value, array<string|int, mixed> &$params) : void
Parameters
- $request : RequestInterface
- $options : array<string|int, mixed>
- $value : mixed
-
as passed via Request transfer options.
- $params : array<string|int, mixed>
addNotification()
private
static addNotification(array<string|int, mixed> &$params, callable $notify) : void
Parameters
- $params : array<string|int, mixed>
- $notify : callable
callArray()
private
static callArray(array<string|int, mixed> $functions) : callable
Parameters
- $functions : array<string|int, mixed>
Return values
callablecheckDecode()
private
checkDecode(array<string|int, mixed> $options, array<string|int, mixed> $headers, resource $stream) : array<string|int, mixed>
Parameters
- $options : array<string|int, mixed>
- $headers : array<string|int, mixed>
- $stream : resource
Return values
array<string|int, mixed>createResource()
Create a resource and check to ensure it was created successfully
private
createResource(callable $callback) : resource
Parameters
- $callback : callable
-
Callable that returns stream resource
Tags
Return values
resourcecreateResponse()
private
createResponse(RequestInterface $request, array<string|int, mixed> $options, resource $stream, float|null $startTime) : PromiseInterface
Parameters
- $request : RequestInterface
- $options : array<string|int, mixed>
- $stream : resource
- $startTime : float|null
Return values
PromiseInterfacecreateSink()
private
createSink(StreamInterface $stream, array<string|int, mixed> $options) : StreamInterface
Parameters
- $stream : StreamInterface
- $options : array<string|int, mixed>
Return values
StreamInterfacecreateStream()
private
createStream(RequestInterface $request, array<string|int, mixed> $options) : resource
Parameters
- $request : RequestInterface
- $options : array<string|int, mixed>
Return values
resourcedrain()
Drains the source stream into the "sink" client option.
private
drain(StreamInterface $source, StreamInterface $sink, string $contentLength) : StreamInterface
Parameters
- $source : StreamInterface
- $sink : StreamInterface
- $contentLength : string
-
Header specifying the amount of data to read.
Tags
Return values
StreamInterfacegetDefaultContext()
private
getDefaultContext(RequestInterface $request) : array<string|int, mixed>
Parameters
- $request : RequestInterface
Return values
array<string|int, mixed>invokeStats()
private
invokeStats(array<string|int, mixed> $options, RequestInterface $request, float|null $startTime[, ResponseInterface|null $response = null ][, Throwable|null $error = null ]) : void
Parameters
- $options : array<string|int, mixed>
- $request : RequestInterface
- $startTime : float|null
- $response : ResponseInterface|null = null
- $error : Throwable|null = null
parse_proxy()
Parses the given proxy URL to make it compatible with the format PHP's stream context expects.
private
parse_proxy(string $url) : array<string|int, mixed>
Parameters
- $url : string
Return values
array<string|int, mixed>resolveHost()
private
resolveHost(RequestInterface $request, array<string|int, mixed> $options) : UriInterface
Parameters
- $request : RequestInterface
- $options : array<string|int, mixed>