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: /**
 6:  * Divides batches into smaller batches under a certain size
 7:  */
 8: class BatchSizeDivisor implements BatchDivisorInterface
 9: {
10:     /**
11:      * @var int Size of each batch
12:      */
13:     protected $size;
14: 
15:     /**
16:      * @param int $size Size of each batch
17:      */
18:     public function __construct($size)
19:     {
20:         $this->size = $size;
21:     }
22: 
23:     /**
24:      * Set the size of each batch
25:      *
26:      * @param int $size Size of each batch
27:      *
28:      * @return BatchSizeDivisor
29:      */
30:     public function setSize($size)
31:     {
32:         $this->size = $size;
33: 
34:         return $this;
35:     }
36: 
37:     /**
38:      * Get the size of each batch
39:      *
40:      * @return int
41:      */
42:     public function getSize()
43:     {
44:         return $this->size;
45:     }
46: 
47:     /**
48:      * {@inheritdoc}
49:      */
50:     public function createBatches(\SplQueue $queue)
51:     {
52:         return array_chunk(iterator_to_array($queue, false), $this->size);
53:     }
54: }
55: 
php-coveralls API documentation generated by ApiGen 2.8.0