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
private \Psr\Http\Message\RequestInterface $request
private \Psr\Http\Message\ResponseInterface|null $response
private float|null $transferTime
private array $handlerStats
private mixed|null $handlerErrorData
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. |
public getRequest(): \Psr\Http\Message\RequestInterface
Returns the response that was received (if any).
public getResponse(): ?\Psr\Http\Message\ResponseInterface
Returns true if a response was received.
public hasResponse(): bool
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.
Get the effective URI the request was sent to.
public getEffectiveUri(): \Psr\Http\Message\UriInterface
Get the estimated time the request was being transferred by the handler.
public getTransferTime(): float|null
Return Value:
Time in seconds.
Gets an array of all of the handler specific transfer data.
public getHandlerStats(): array
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. |