CurlFactory
in package
implements
CurlFactoryInterface
Creates curl resources from a request
Table of Contents
Interfaces
Constants
- CURL_VERSION_STR = 'curl_version'
- LOW_CURL_VERSION_NUMBER = '7.21.2'
Properties
- $handles : array<string|int, mixed>
- $maxHandles : int
Methods
- __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
Total number of idle handles to keep in cache
Methods
__construct()
public
__construct(int $maxHandles) : mixed
Parameters
- $maxHandles : int
-
Maximum number of idle handles.
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
EasyHandlefinish()
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
PromiseInterfacerelease()
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
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>
applyHandlerOptions()
private
applyHandlerOptions(EasyHandle $easy, array<string|int, mixed> &$conf) : mixed
Parameters
- $easy : EasyHandle
- $conf : array<string|int, mixed>
applyHeaders()
private
applyHeaders(EasyHandle $easy, array<string|int, mixed> &$conf) : mixed
Parameters
- $easy : EasyHandle
- $conf : array<string|int, mixed>
applyMethod()
private
applyMethod(EasyHandle $easy, array<string|int, mixed> &$conf) : mixed
Parameters
- $easy : EasyHandle
- $conf : array<string|int, mixed>
createHeaderFn()
private
createHeaderFn(EasyHandle $easy) : mixed
Parameters
- $easy : EasyHandle
createRejection()
private
static createRejection(EasyHandle $easy, array<string|int, mixed> $ctx) : mixed
Parameters
- $easy : EasyHandle
- $ctx : array<string|int, mixed>
finishError()
private
static finishError(callable $handler, EasyHandle $easy, CurlFactoryInterface $factory) : mixed
Parameters
- $handler : callable
- $easy : EasyHandle
- $factory : CurlFactoryInterface
getDefaultConf()
private
getDefaultConf(EasyHandle $easy) : mixed
Parameters
- $easy : EasyHandle
invokeStats()
private
static invokeStats(EasyHandle $easy) : mixed
Parameters
- $easy : EasyHandle
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
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>