protected function validateBatchIndexExists($index) { if (!isset($this->batches[$index])) { throw new InvalidArgumentException(sprintf('Batch index "%s" does not exist.', $index)); } }