/** * @param BatchInterface $decoratedBatch Batch object to decorate * @param mixed $callable Callable to call * * @throws InvalidArgumentException */ public function __construct(BatchInterface $decoratedBatch, $callable) { if (!is_callable($callable)) { throw new InvalidArgumentException('The passed argument is not callable'); } $this->callable = $callable; parent::__construct($decoratedBatch); }
/** * {@inheritdoc} */ public function add($item) { if ($item instanceof AbstractCommand && $item->getName() == 'DeleteObject') { $item = array('Key' => $item['Key'], 'VersionId' => $item['VersionId']); } if (!is_array($item) || !isset($item['Key'])) { throw new InvalidArgumentException('Item must be a DeleteObject command or array containing a Key and VersionId key.'); } return parent::add($item); }