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

  • AbstractBatchDecorator
  • Batch
  • BatchBuilder
  • BatchClosureDivisor
  • BatchClosureTransfer
  • BatchCommandTransfer
  • BatchRequestTransfer
  • BatchSizeDivisor
  • ExceptionBufferingBatch
  • FlushingBatch
  • HistoryBatch
  • NotifyingBatch

Interfaces

  • BatchDivisorInterface
  • BatchInterface
  • BatchTransferInterface
  • Overview
  • Namespace
  • Class
  • Tree
  • Todo
 1: <?php
 2: 
 3: namespace Guzzle\Batch;
 4: 
 5: use Guzzle\Batch\Exception\BatchTransferException;
 6: 
 7: /**
 8:  * BatchInterface decorator used to buffer exceptions encountered during a transfer.  The exceptions can then later be
 9:  * processed after a batch flush has completed.
10:  */
11: class ExceptionBufferingBatch extends AbstractBatchDecorator
12: {
13:     /**
14:      * @var array Array of BatchTransferException exceptions
15:      */
16:     protected $exceptions = array();
17: 
18:     /**
19:      * {@inheritdoc}
20:      */
21:     public function flush()
22:     {
23:         $items = array();
24: 
25:         while (!$this->decoratedBatch->isEmpty()) {
26:             try {
27:                 $transferredItems = $this->decoratedBatch->flush();
28:             } catch (BatchTransferException $e) {
29:                 $this->exceptions[] = $e;
30:                 $transferredItems = $e->getTransferredItems();
31:             }
32:             $items = array_merge($items, $transferredItems);
33:         }
34: 
35:         return $items;
36:     }
37: 
38:     /**
39:      * Get the buffered exceptions
40:      *
41:      * @return array Array of BatchTransferException objects
42:      */
43:     public function getExceptions()
44:     {
45:         return $this->exceptions;
46:     }
47: 
48:     /**
49:      * Clear the buffered exceptions
50:      */
51:     public function clearExceptions()
52:     {
53:         $this->exceptions = array();
54:     }
55: }
56: 
php-coveralls API documentation generated by ApiGen 2.8.0