RequestMediator
in package
Mediator between curl handles and request objects
Table of Contents
Properties
- $emitIo : bool
- $request : RequestInterface
Methods
- __construct() : mixed
- progress() : mixed
- Received a progress notification
- readRequestBody() : string
- Read data from the request body and send it to curl
- receiveResponseHeader() : int
- Receive a response header from curl
- writeResponseBody() : int
- Write data to the response body of a request
Properties
$emitIo
protected
bool
$emitIo
Whether or not to emit read/write events
$request
protected
RequestInterface
$request
Methods
__construct()
public
__construct(RequestInterface $request[, bool $emitIo = false ]) : mixed
Parameters
- $request : RequestInterface
-
Request to mediate
- $emitIo : bool = false
-
Set to true to dispatch events on input and output
progress()
Received a progress notification
public
progress(int $downloadSize, int $downloaded, int $uploadSize, int $uploaded[, resource $handle = null ]) : mixed
Parameters
- $downloadSize : int
-
Total download size
- $downloaded : int
-
Amount of bytes downloaded
- $uploadSize : int
-
Total upload size
- $uploaded : int
-
Amount of bytes uploaded
- $handle : resource = null
-
CurlHandle object
readRequestBody()
Read data from the request body and send it to curl
public
readRequestBody(resource $ch, resource $fd, int $length) : string
Parameters
- $ch : resource
-
Curl handle
- $fd : resource
-
File descriptor
- $length : int
-
Amount of data to read
Return values
stringreceiveResponseHeader()
Receive a response header from curl
public
receiveResponseHeader(resource $curl, string $header) : int
Parameters
- $curl : resource
-
Curl handle
- $header : string
-
Received header
Return values
intwriteResponseBody()
Write data to the response body of a request
public
writeResponseBody(resource $curl, string $write) : int
Parameters
- $curl : resource
-
Curl handle
- $write : string
-
Data that was received