Skip to content

Latest commit

 

History

History
301 lines (104 loc) · 2.82 KB

TransferStats.md

File metadata and controls

301 lines (104 loc) · 2.82 KB

TransferStats

Represents data at the point after it was transferred either successfully or after a network error.

  • Full name: \GuzzleHttp\TransferStats
  • This class is marked as final and can't be subclassed
  • This class is a Final class

Properties

request

private \Psr\Http\Message\RequestInterface $request

response

private \Psr\Http\Message\ResponseInterface|null $response

transferTime

private float|null $transferTime

handlerStats

private array $handlerStats

handlerErrorData

private mixed|null $handlerErrorData

Methods

__construct

public __construct(\Psr\Http\Message\RequestInterface $request, \Psr\Http\Message\ResponseInterface|null $response = null, float|null $transferTime = null, mixed $handlerErrorData = null, array $handlerStats = []): mixed

Parameters:

Parameter Type Description
$request \Psr\Http\Message\RequestInterface Request that was sent.
$response \Psr\Http\Message\ResponseInterface|null Response received (if any)
$transferTime float|null Total handler transfer time.
$handlerErrorData mixed Handler error data.
$handlerStats array Handler specific stats.

getRequest

public getRequest(): \Psr\Http\Message\RequestInterface

getResponse

Returns the response that was received (if any).

public getResponse(): ?\Psr\Http\Message\ResponseInterface

hasResponse

Returns true if a response was received.

public hasResponse(): bool

getHandlerErrorData

Gets handler specific error data.

public getHandlerErrorData(): mixed

This might be an exception, a integer representing an error code, or anything else. Relying on this value assumes that you know what handler you are using.


getEffectiveUri

Get the effective URI the request was sent to.

public getEffectiveUri(): \Psr\Http\Message\UriInterface

getTransferTime

Get the estimated time the request was being transferred by the handler.

public getTransferTime(): float|null

Return Value:

Time in seconds.


getHandlerStats

Gets an array of all of the handler specific transfer data.

public getHandlerStats(): array

getHandlerStat

Get a specific handler statistic from the handler by name.

public getHandlerStat(string $stat): mixed|null

Parameters:

Parameter Type Description
$stat string Handler specific transfer stat to retrieve.