Overview

Namespaces

  • Contrib
    • Bundle
      • CoverallsBundle
        • Console
        • Entity
      • CoverallsV1Bundle
        • Api
        • Collector
        • Command
        • Config
        • Entity
          • Git
    • Component
      • File
      • Log
      • System
        • Git
  • Guzzle
    • Batch
      • Exception
    • Cache
    • Common
      • Exception
    • Http
      • Curl
      • Exception
      • Message
      • QueryAggregator
    • Inflection
    • Iterator
    • Log
    • Parser
      • Cookie
      • Message
      • UriTemplate
      • Url
    • Plugin
      • Async
      • Backoff
      • Cache
      • Cookie
        • CookieJar
        • Exception
      • CurlAuth
      • ErrorResponse
        • Exception
      • History
      • Log
      • Md5
      • Mock
      • Oauth
    • Service
      • Builder
      • Command
        • Factory
        • LocationVisitor
          • Request
          • Response
      • Description
      • Exception
      • Resource
    • Stream
  • PHP
  • Psr
    • Log
  • Symfony
    • Component
      • Config
        • Definition
          • Builder
          • Exception
        • Exception
        • Loader
        • Resource
        • Util
      • Console
        • Command
        • Formatter
        • Helper
        • Input
        • Output
        • Tester
      • EventDispatcher
        • Debug
      • Finder
        • Adapter
        • Comparator
        • Exception
        • Expression
        • Iterator
        • Shell
      • Stopwatch
      • Yaml
        • Exception

Classes

  • AbstractBackoffStrategy
  • AbstractErrorCodeBackoffStrategy
  • BackoffLogger
  • BackoffPlugin
  • CallbackBackoffStrategy
  • ConstantBackoffStrategy
  • CurlBackoffStrategy
  • ExponentialBackoffStrategy
  • HttpBackoffStrategy
  • LinearBackoffStrategy
  • ReasonPhraseBackoffStrategy
  • TruncatedBackoffStrategy

Interfaces

  • BackoffStrategyInterface
  • Overview
  • Namespace
  • Class
  • Tree
  • Todo
 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 that will not retry more than a certain number of times.
11:  */
12: class TruncatedBackoffStrategy extends AbstractBackoffStrategy
13: {
14:     /**
15:      * @var int Maximum number of retries per request
16:      */
17:     protected $max;
18: 
19:     /**
20:      * @param int                      $maxRetries Maximum number of retries per request
21:      * @param BackoffStrategyInterface $next The optional next strategy
22:      */
23:     public function __construct($maxRetries, BackoffStrategyInterface $next = null)
24:     {
25:         $this->max = $maxRetries;
26:         $this->next = $next;
27:     }
28: 
29:     /**
30:      * {@inheritdoc}
31:      */
32:     public function makesDecision()
33:     {
34:         return true;
35:     }
36: 
37:     /**
38:      * {@inheritdoc}
39:      */
40:     protected function getDelay($retries, RequestInterface $request, Response $response = null, HttpException $e = null)
41:     {
42:         return $retries < $this->max ? null : false;
43:     }
44: }
45: 
php-coveralls API documentation generated by ApiGen 2.8.0