SDK for PHP 3.x

WrappedHttpHandler
in package

Converts an HTTP handler into a Command HTTP handler.

HTTP handlers have the following signature: function(RequestInterface $request, array $options) : PromiseInterface

The promise returned form an HTTP handler must resolve to a PSR-7 response object when fulfilled or an error array when rejected. The error array can contain the following data:

  • exception: (required, Exception) Exception that was encountered.
  • response: (ResponseInterface) PSR-7 response that was received (if a response) was received.
  • connection_error: (bool) True if the error is the result of failing to connect.

Table of Contents

Methods

__construct()  : mixed
__invoke()  : PromiseInterface
Calls the simpler HTTP specific handler and wraps the returned promise with AWS specific values (e.g., a result object or AWS exception).

Methods

__construct()

public __construct(callable $httpHandler, callable $parser, callable $errorParser[, string $exceptionClass = AwsException::class ][, bool $collectStats = false ]) : mixed
Parameters
$httpHandler : callable

Function that accepts a request and array of request options and returns a promise that fulfills with a response or rejects with an error array.

$parser : callable

Function that accepts a response object and returns an AWS result object.

$errorParser : callable

Function that parses a response object into AWS error data.

$exceptionClass : string = AwsException::class

Exception class to throw.

$collectStats : bool = false

Whether to collect HTTP transfer information.

On this page