1: <?php
2:
3: namespace Guzzle\Plugin\Backoff;
4:
5: use Guzzle\Http\Message\RequestInterface;
6: use Guzzle\Http\Message\Response;
7: use Guzzle\Http\Exception\HttpException;
8:
9: /**
10: * Strategy used to retry HTTP requests when the response's reason phrase matches one of the registered phrases.
11: */
12: class ReasonPhraseBackoffStrategy extends AbstractErrorCodeBackoffStrategy
13: {
14: /**
15: * {@inheritdoc}
16: */
17: public function makesDecision()
18: {
19: return true;
20: }
21:
22: /**
23: * {@inheritdoc}
24: */
25: protected function getDelay($retries, RequestInterface $request, Response $response = null, HttpException $e = null)
26: {
27: if ($response) {
28: return isset($this->errorCodes[$response->getReasonPhrase()]) ? true : null;
29: }
30: }
31: }
32: