getZipArchive(); $zipArchive->open($zipFile); $this->saveMetaData($zipArchive, self::DELIVERY_META_DATA_JSON, json_encode($metaData['deliveryMetaData'])); $this->saveMetaData($zipArchive, self::TEST_META_DATA_JSON, json_encode($metaData['testMetaData'])); $this->saveMetaData($zipArchive, self::ITEM_META_DATA_JSON, json_encode($metaData['itemMetaData'])); $zipArchive->close(); } private function saveMetaData(ZipArchive $zipFile, string $fileNameToAdd, string $content): void { $zipFile->addFromString($fileNameToAdd, $content); } private function getZipArchive(): ZipArchive { $zipArchive = $this->getOption(self::OPTION_ZIP_ARCHIVE_SERVICE); return $zipArchive ?? new ZipArchive(); } }