Open Journal Systems  3.3.0
Guzzle\Plugin\Backoff\CallbackBackoffStrategy Class Reference
Inheritance diagram for Guzzle\Plugin\Backoff\CallbackBackoffStrategy:
Guzzle\Plugin\Backoff\AbstractBackoffStrategy Guzzle\Plugin\Backoff\BackoffStrategyInterface

Public Member Functions

 __construct ($callback, $decision, BackoffStrategyInterface $next=null)
 
 makesDecision ()
 
- Public Member Functions inherited from Guzzle\Plugin\Backoff\AbstractBackoffStrategy
 getBackoffPeriod ( $retries, RequestInterface $request, Response $response=null, HttpException $e=null)
 
 getNext ()
 
 setNext (AbstractBackoffStrategy $next)
 

Protected Member Functions

 getDelay ($retries, RequestInterface $request, Response $response=null, HttpException $e=null)
 

Protected Attributes

 $callback
 
 $decision
 
- Protected Attributes inherited from Guzzle\Plugin\Backoff\AbstractBackoffStrategy
 $next
 

Detailed Description

Strategy that will invoke a closure to determine whether or not to retry with a delay

Definition at line 13 of file CallbackBackoffStrategy.php.

Constructor & Destructor Documentation

◆ __construct()

Guzzle\Plugin\Backoff\CallbackBackoffStrategy::__construct (   $callback,
  $decision,
BackoffStrategyInterface  $next = null 
)
Parameters
\Closure | array | mixed$callbackCallable method to invoke
bool$decisionSet to true if this strategy makes a backoff decision
BackoffStrategyInterface$nextThe optional next strategy
Exceptions
InvalidArgumentException

Definition at line 34 of file CallbackBackoffStrategy.php.

References Guzzle\Plugin\Backoff\CallbackBackoffStrategy\$callback, Guzzle\Plugin\Backoff\CallbackBackoffStrategy\$decision, and Guzzle\Plugin\Backoff\AbstractBackoffStrategy\$next.

Member Function Documentation

◆ getDelay()

Guzzle\Plugin\Backoff\CallbackBackoffStrategy::getDelay (   $retries,
RequestInterface  $request,
Response  $response = null,
HttpException  $e = null 
)
protected

Implement the concrete strategy

Parameters
int$retriesNumber of retries of the request
RequestInterface$requestRequest that was sent
Response$responseResponse that was received. Note that there may not be a response
HttpException$eException that was encountered if any
Returns
bool|int|null Returns false to not retry or the number of seconds to delay between retries. Return true or null to defer to the next strategy if available, and if not, return 0.

Reimplemented from Guzzle\Plugin\Backoff\AbstractBackoffStrategy.

Definition at line 49 of file CallbackBackoffStrategy.php.

◆ makesDecision()

Guzzle\Plugin\Backoff\CallbackBackoffStrategy::makesDecision ( )

Check if the strategy does filtering and makes decisions on whether or not to retry.

Strategies that return false will never retry if all of the previous strategies in a chain defer on a backoff decision.

Returns
bool

Reimplemented from Guzzle\Plugin\Backoff\AbstractBackoffStrategy.

Definition at line 44 of file CallbackBackoffStrategy.php.

References Guzzle\Plugin\Backoff\CallbackBackoffStrategy\$decision.

Field Documentation

◆ $callback

Closure array mixed Guzzle\Plugin\Backoff\CallbackBackoffStrategy::$callback
protected

Callable method to invoke

Definition at line 19 of file CallbackBackoffStrategy.php.

Referenced by Guzzle\Plugin\Backoff\CallbackBackoffStrategy\__construct().

◆ $decision

bool Guzzle\Plugin\Backoff\CallbackBackoffStrategy::$decision
protected

Whether or not this strategy makes a retry decision

Definition at line 25 of file CallbackBackoffStrategy.php.

Referenced by Guzzle\Plugin\Backoff\CallbackBackoffStrategy\__construct(), and Guzzle\Plugin\Backoff\CallbackBackoffStrategy\makesDecision().


The documentation for this class was generated from the following file: