AsyncContext
in package
FinalYes
A DTO to work with AsyncResponse.
Tags
Table of Contents
Properties
Methods
- __construct() : mixed
- cancel() : ChunkInterface
- Cancels the request and returns the last chunk to yield.
- createChunk() : ChunkInterface
- Creates a new chunk of content.
- getContent() : resource|null
- getHeaders() : array<string|int, mixed>
- Returns the headers without consuming the response.
- getInfo() : mixed
- Returns the current info of the response.
- getResponse() : ResponseInterface
- Returns the currently processed response.
- getStatusCode() : int
- Returns the HTTP status without consuming the response.
- passthru() : void
- Replaces or removes the chunk filter iterator.
- pause() : void
- Pauses the request for the given number of seconds.
- replaceRequest() : ResponseInterface
- Replaces the currently processed response by doing a new request.
- replaceResponse() : ResponseInterface
- Replaces the currently processed response by another one.
- setInfo() : $this
- Attaches an info to the response.
Properties
$client
private
mixed
$client
$content
private
mixed
$content
$info
private
mixed
$info
= []
$offset
private
mixed
$offset
$passthru
private
mixed
$passthru
$response
private
mixed
$response
Methods
__construct()
public
__construct(mixed &$passthru, HttpClientInterface $client, ResponseInterface &$response, array<string|int, mixed> &$info, mixed $content, int $offset) : mixed
Parameters
- $passthru : mixed
- $client : HttpClientInterface
- $response : ResponseInterface
- $info : array<string|int, mixed>
- $content : mixed
- $offset : int
cancel()
Cancels the request and returns the last chunk to yield.
public
cancel() : ChunkInterface
Return values
ChunkInterfacecreateChunk()
Creates a new chunk of content.
public
createChunk(string $data) : ChunkInterface
Parameters
- $data : string
Return values
ChunkInterfacegetContent()
public
getContent() : resource|null
Return values
resource|null —The PHP stream resource where the content is buffered, if it is
getHeaders()
Returns the headers without consuming the response.
public
getHeaders() : array<string|int, mixed>
Return values
array<string|int, mixed>getInfo()
Returns the current info of the response.
public
getInfo([string|null $type = null ]) : mixed
Parameters
- $type : string|null = null
getResponse()
Returns the currently processed response.
public
getResponse() : ResponseInterface
Return values
ResponseInterfacegetStatusCode()
Returns the HTTP status without consuming the response.
public
getStatusCode() : int
Return values
intpassthru()
Replaces or removes the chunk filter iterator.
public
passthru([callable(ChunkInterface, self): Array|null $passthru = null ]) : void
Parameters
- $passthru : callable(ChunkInterface, self): Array|null = null
pause()
Pauses the request for the given number of seconds.
public
pause(float $duration) : void
Parameters
- $duration : float
replaceRequest()
Replaces the currently processed response by doing a new request.
public
replaceRequest(string $method, string $url[, array<string|int, mixed> $options = [] ]) : ResponseInterface
Parameters
- $method : string
- $url : string
- $options : array<string|int, mixed> = []
Return values
ResponseInterfacereplaceResponse()
Replaces the currently processed response by another one.
public
replaceResponse(ResponseInterface $response) : ResponseInterface
Parameters
- $response : ResponseInterface
Return values
ResponseInterfacesetInfo()
Attaches an info to the response.
public
setInfo(string $type, mixed $value) : $this
Parameters
- $type : string
- $value : mixed