You are here

public function RetryMiddleware::__invoke in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/guzzlehttp/guzzle/src/RetryMiddleware.php \GuzzleHttp\RetryMiddleware::__invoke()

Parameters

RequestInterface $request:

array $options:

Return value

PromiseInterface

File

vendor/guzzlehttp/guzzle/src/RetryMiddleware.php, line 59

Class

RetryMiddleware
Middleware that retries requests based on the boolean result of invoking the provided "decider" function.

Namespace

GuzzleHttp

Code

public function __invoke(RequestInterface $request, array $options) {
  if (!isset($options['retries'])) {
    $options['retries'] = 0;
  }
  $fn = $this->nextHandler;
  return $fn($request, $options)
    ->then($this
    ->onFulfilled($request, $options), $this
    ->onRejected($request, $options));
}