private function commit() { if (count($this->batch->getOperations())) { $this->client->commitBatch(); } else { $this->client->endBatch(); } $this->batch = null; }