[ Index ]

PHP Cross Reference of phpBB-3.2.11-deutsch

title

Body

[close]

/vendor/guzzlehttp/guzzle/src/Event/ -> AbstractRetryableEvent.php (source)

   1  <?php
   2  namespace GuzzleHttp\Event;
   3  
   4  /**
   5   * Abstract request event that can be retried.
   6   */
   7  class AbstractRetryableEvent extends AbstractTransferEvent
   8  {
   9      /**
  10       * Mark the request as needing a retry and stop event propagation.
  11       *
  12       * This action allows you to retry a request without emitting the "end"
  13       * event multiple times for a given request. When retried, the request
  14       * emits a before event and is then sent again using the client that sent
  15       * the original request.
  16       *
  17       * When retrying, it is important to limit the number of retries you allow
  18       * to prevent infinite loops.
  19       *
  20       * This action can only be taken during the "complete" and "error" events.
  21       *
  22       * @param int $afterDelay If specified, the amount of time in milliseconds
  23       *                        to delay before retrying. Note that this must
  24       *                        be supported by the underlying RingPHP handler
  25       *                        to work properly. Set to 0 or provide no value
  26       *                        to retry immediately.
  27       */
  28      public function retry($afterDelay = 0)
  29      {
  30          // Setting the transition state to 'retry' will cause the next state
  31          // transition of the transaction to retry the request.
  32          $this->transaction->state = 'retry';
  33  
  34          if ($afterDelay) {
  35              $this->transaction->request->getConfig()->set('delay', $afterDelay);
  36          }
  37  
  38          $this->stopPropagation();
  39      }
  40  }


Generated: Wed Nov 11 20:33:01 2020 Cross-referenced by PHPXref 0.7.1