Open Journal Systems  3.3.0
HttpBackoffStrategy.php
1 <?php
2 
3 namespace Guzzle\Plugin\Backoff;
4 
8 
15 {
17  protected static $defaultErrorCodes = array(500, 503);
18 
19  protected function getDelay($retries, RequestInterface $request, Response $response = null, HttpException $e = null)
20  {
21  if ($response) {
22  //Short circuit the rest of the checks if it was successful
23  if ($response->isSuccessful()) {
24  return false;
25  } else {
26  return isset($this->errorCodes[$response->getStatusCode()]) ? true : null;
27  }
28  }
29  }
30 }
Guzzle\Http\Message\RequestInterface
Definition: lib/vendor/guzzle/guzzle/src/Guzzle/Http/Message/RequestInterface.php:16
Guzzle\Http\Exception\HttpException
Definition: lib/vendor/guzzle/guzzle/src/Guzzle/Http/Exception/HttpException.php:10
Guzzle\Http\Message\Response
Definition: lib/vendor/guzzle/guzzle/src/Guzzle/Http/Message/Response.php:17
Guzzle\Plugin\Backoff
Definition: AbstractBackoffStrategy.php:3
Guzzle\Plugin\Backoff\HttpBackoffStrategy\getDelay
getDelay($retries, RequestInterface $request, Response $response=null, HttpException $e=null)
Definition: HttpBackoffStrategy.php:19
Guzzle\Plugin\Backoff\AbstractErrorCodeBackoffStrategy
Definition: AbstractErrorCodeBackoffStrategy.php:8
Guzzle\Plugin\Backoff\HttpBackoffStrategy
Definition: HttpBackoffStrategy.php:14
Guzzle\Plugin\Backoff\HttpBackoffStrategy\$defaultErrorCodes
static $defaultErrorCodes
Definition: HttpBackoffStrategy.php:17