Open Journal Systems  3.3.0
BatchClosureTransfer.php
1 <?php
2 
3 namespace Guzzle\Batch;
4 
6 
12 {
14  protected $callable;
15 
17  protected $context;
18 
26  public function __construct($callable, $context = null)
27  {
28  if (!is_callable($callable)) {
29  throw new InvalidArgumentException('Argument must be callable');
30  }
31 
32  $this->callable = $callable;
33  $this->context = $context;
34  }
35 
36  public function transfer(array $batch)
37  {
38  return empty($batch) ? null : call_user_func($this->callable, $batch, $this->context);
39  }
40 }
Guzzle\Batch
Definition: AbstractBatchDecorator.php:3
Guzzle\Batch\BatchTransferInterface
Definition: BatchTransferInterface.php:8
Guzzle\Batch\BatchClosureTransfer
Definition: BatchClosureTransfer.php:11
Guzzle\Batch\BatchClosureTransfer\$context
$context
Definition: BatchClosureTransfer.php:23
Guzzle\Batch\BatchClosureTransfer\transfer
transfer(array $batch)
Definition: BatchClosureTransfer.php:42
Guzzle\Common\Exception\InvalidArgumentException
Definition: lib/vendor/guzzle/guzzle/src/Guzzle/Common/Exception/InvalidArgumentException.php:5
Guzzle\Batch\BatchClosureTransfer\__construct
__construct($callable, $context=null)
Definition: BatchClosureTransfer.php:32
Guzzle\Batch\BatchClosureTransfer\$callable
$callable
Definition: BatchClosureTransfer.php:17