NOTE: For Version 3 of the AWS SDK for PHP, please see the V3 User Guide and V3 API Reference.

# Class BatchClosureDivisor

Divides batches using a callable

  Guzzle\Batch\BatchClosureDivisor implements Guzzle\Batch\BatchDivisorInterface

Namespace: Guzzle\Batch
Located at Guzzle/Batch/BatchClosureDivisor.php

## Methods summary

- `public` `__construct ( callable $callable, mixed $context = null )`
- `public` `createBatches ( SplQueue $queue )`

  Divide a queue of items into an array batches

## Methods detail

# `public`
`__construct( callable $callable, mixed $context = null )`

#### Parameters

$callable
  `callable`
  $callable Method used to divide the batches. The method must accept an \SplQueue and return an array of arrays containing the divided items.
$context
  `mixed`
  $context Optional context to pass to the batch divisor

#### Throws

``Guzzle\Common\Exception\InvalidArgumentException``
if the callable is not callable
# `public array|`Traversable``
`createBatches( `SplQueue` $queue )`

Divide a queue of items into an array batches

#### Parameters

$queue
  ``SplQueue``
  $queue Queue of items to divide into batches. Items are removed as they are iterated.

#### Returns

`array|`Traversable``
Returns an array or Traversable object that contains arrays of items to transfer

#### Implementation of

`Guzzle\Batch\BatchDivisorInterface::createBatches()`

### Magic methods summary

## Properties summary

`protected callable` | $callable | # Method used to divide the batches
`protected mixed` | $context | # $context Context passed to the callable