$chunks = array_chunk($operations, self::MODIFIERS_PER_BATCH);
$len = count($chunks);
for ($i = 0; $i < $len; $i++) {
//if first chunk
if ($i == 0) {
$batchJobUploadStatus = $batchJobs->uploadIncrementalBatchJobOperations(
[],
new BatchJobUploadStatus($this->uploadUrl, $this->sess)
);
//everything in the middle
} else {
$batchJobUploadStatus = $batchJobs->uploadIncrementalBatchJobOperations(
[],
$batchJobUploadStatus
);
}
//if last chunk, close the upload
if ($i == ($len - 1)) {
$batchJobs->closeIncrementalUpload($batchJobUploadStatus);
}
}