CurlFactory
in package
implements
CurlFactoryInterface
Creates curl resources from a request
Interfaces, Classes and Traits
Table of Contents
- CURL_VERSION_STR = 'curl_version'
- LOW_CURL_VERSION_NUMBER = '7.21.2'
- $handles : array<string|int, mixed>
- $maxHandles : int
- __construct() : mixed
- create() : EasyHandle
- Creates a cURL handle resource.
- finish() : PromiseInterface
- Completes a cURL transaction, either returning a response promise or a rejected promise.
- release() : mixed
- Release an easy handle, allowing it to be reused or closed.
- applyBody() : mixed
- applyHandlerOptions() : mixed
- applyHeaders() : mixed
- applyMethod() : mixed
- createHeaderFn() : mixed
- createRejection() : mixed
- finishError() : mixed
- getDefaultConf() : mixed
- invokeStats() : mixed
- removeHeader() : mixed
- Remove a header from the options array.
- retryFailedRewind() : mixed
- This function ensures that a response was set on a transaction. If one was not set, then the request is retried if possible. This error typically means you are sending a payload, curl encountered a "Connection died, retrying a fresh connect" error, tried to rewind the stream, and then encountered a "necessary data rewind wasn't possible" error, causing the request to be sent through curl_multi_info_read() without an error status.
Constants
CURL_VERSION_STR
public
mixed
CURL_VERSION_STR
= 'curl_version'
LOW_CURL_VERSION_NUMBER
public
mixed
LOW_CURL_VERSION_NUMBER
= '7.21.2'
Properties
$handles
private
array<string|int, mixed>
$handles
= []
$maxHandles
private
int
$maxHandles
Methods
__construct()
public
__construct(int $maxHandles) : mixed
Parameters
- $maxHandles : int
-
Maximum number of idle handles.
Return values
mixed —create()
Creates a cURL handle resource.
public
create(RequestInterface $request, array<string|int, mixed> $options) : EasyHandle
Parameters
- $request : RequestInterface
-
Request
- $options : array<string|int, mixed>
-
Transfer options
Return values
EasyHandle —finish()
Completes a cURL transaction, either returning a response promise or a rejected promise.
public
static finish(callable $handler, EasyHandle $easy, CurlFactoryInterface $factory) : PromiseInterface
Parameters
- $handler : callable
- $easy : EasyHandle
- $factory : CurlFactoryInterface
-
Dictates how the handle is released
Return values
PromiseInterface —release()
Release an easy handle, allowing it to be reused or closed.
public
release(EasyHandle $easy) : mixed
This function must call unset on the easy handle's "handle" property.
Parameters
- $easy : EasyHandle
Return values
mixed —applyBody()
private
applyBody(RequestInterface $request, array<string|int, mixed> $options, array<string|int, mixed> &$conf) : mixed
Parameters
- $request : RequestInterface
- $options : array<string|int, mixed>
- $conf : array<string|int, mixed>
Return values
mixed —applyHandlerOptions()
private
applyHandlerOptions(EasyHandle $easy, array<string|int, mixed> &$conf) : mixed
Parameters
- $easy : EasyHandle
- $conf : array<string|int, mixed>
Return values
mixed —applyHeaders()
private
applyHeaders(EasyHandle $easy, array<string|int, mixed> &$conf) : mixed
Parameters
- $easy : EasyHandle
- $conf : array<string|int, mixed>
Return values
mixed —applyMethod()
private
applyMethod(EasyHandle $easy, array<string|int, mixed> &$conf) : mixed
Parameters
- $easy : EasyHandle
- $conf : array<string|int, mixed>
Return values
mixed —createHeaderFn()
private
createHeaderFn(EasyHandle $easy) : mixed
Parameters
- $easy : EasyHandle
Return values
mixed —createRejection()
private
static createRejection(EasyHandle $easy, array<string|int, mixed> $ctx) : mixed
Parameters
- $easy : EasyHandle
- $ctx : array<string|int, mixed>
Return values
mixed —finishError()
private
static finishError(callable $handler, EasyHandle $easy, CurlFactoryInterface $factory) : mixed
Parameters
- $handler : callable
- $easy : EasyHandle
- $factory : CurlFactoryInterface
Return values
mixed —getDefaultConf()
private
getDefaultConf(EasyHandle $easy) : mixed
Parameters
- $easy : EasyHandle
Return values
mixed —invokeStats()
private
static invokeStats(EasyHandle $easy) : mixed
Parameters
- $easy : EasyHandle
Return values
mixed —removeHeader()
Remove a header from the options array.
private
removeHeader(string $name, array<string|int, mixed> &$options) : mixed
Parameters
- $name : string
-
Case-insensitive header to remove
- $options : array<string|int, mixed>
-
Array of options to modify
Return values
mixed —retryFailedRewind()
This function ensures that a response was set on a transaction. If one was not set, then the request is retried if possible. This error typically means you are sending a payload, curl encountered a "Connection died, retrying a fresh connect" error, tried to rewind the stream, and then encountered a "necessary data rewind wasn't possible" error, causing the request to be sent through curl_multi_info_read() without an error status.
private
static retryFailedRewind(callable $handler, EasyHandle $easy, array<string|int, mixed> $ctx) : mixed
Parameters
- $handler : callable
- $easy : EasyHandle
- $ctx : array<string|int, mixed>