Copied!

Handler that returns responses or throw exceptions from a queue.

  • final
CloneableInstantiable
Methods
public __construct(?array $queue = NULL, ?callable $onFulfilled = NULL, ?callable $onRejected = NULL)
 

The passed in value must be an array of {@see \Psr\Http\Message\ResponseInterface} objects, Exceptions, callables, or Promises.

  • param array<int,mixed>|null $queue The parameters to be passed to the append function, as an indexed array.
  • param callable|null $onFulfilled Callback to invoke when the return value is fulfilled.
  • param callable|null $onRejected Callback to invoke when the return value is rejected.
public __invoke(Psr\Http\Message\RequestInterface $request, array $options) : GuzzleHttp\Promise\PromiseInterface
public append( $values) : void
 

Adds one or more variadic requests, exceptions, callables, or promises to the queue.

  • param mixed $values
public count() : int
 

Returns the number of remaining items in the queue.

public static createWithMiddleware(?array $queue = NULL, ?callable $onFulfilled = NULL, ?callable $onRejected = NULL) : GuzzleHttp\HandlerStack
 

Creates a new MockHandler that uses the default handler stack list of middlewares.

  • param array|null $queue Array of responses, callables, or exceptions.
  • param callable|null $onFulfilled Callback to invoke when the return value is fulfilled.
  • param callable|null $onRejected Callback to invoke when the return value is rejected.
public getLastOptions() : array
 

Get the last received request options.

public getLastRequest() : ?Psr\Http\Message\RequestInterface
 

Get the last received request.

public reset() : void
Properties
private $lastOptions = []
 
  • var array
private $lastRequest = NULL
 
  • var \RequestInterface|null
private $onFulfilled = NULL
 
  • var callable|null
private $onRejected = NULL
 
  • var callable|null
private $queue = []
 
  • var array
Methods
private invokeStats(Psr\Http\Message\RequestInterface $request, array $options, ?Psr\Http\Message\ResponseInterface $response = NULL, $reason = NULL) : void
 
  • param mixed $reason Promise or reason.
Methods
public static createWithMiddleware(?array $queue = NULL, ?callable $onFulfilled = NULL, ?callable $onRejected = NULL) : GuzzleHttp\HandlerStack
 

Creates a new MockHandler that uses the default handler stack list of middlewares.

  • param array|null $queue Array of responses, callables, or exceptions.
  • param callable|null $onFulfilled Callback to invoke when the return value is fulfilled.
  • param callable|null $onRejected Callback to invoke when the return value is rejected.
© 2024 Bruce Wells
Search Namespaces \ Classes
Configuration