original_string: public function createDummyZipArchive($fileName = 'test.zip', array $filesToAddToArchive = [])
      {
          $this->checkForZipArchive();
  
          $this->createDummyUploadFolder();
          $uniqueFileName = $this->getUniqueFileOrFolderPath($fileName);
          $zip = new ZipArchive();
  
          if ($zip->open($uniqueFileName, ZipArchive::CREATE) !== true) {
              throw new Exception('The new ZIP archive "' . $fileName . '" could not be created.', 1334439299);
          }
  
          $contents = !empty($filesToAddToArchive) ? $filesToAddToArchive : [$this->createDummyFile()];
  
          foreach ($contents as $pathToFile) {
              if (!file_exists($pathToFile)) {
                  throw new Exception(
                      'The provided path "' . $pathToFile . '" does not point to an existing file.',
                      1334439306
                  );
              }
              $zip->addFile($pathToFile, $this->getPathRelativeToUploadDirectory($pathToFile));
          }
  
          $zip->close();
          $this->addToDummyFileList($uniqueFileName);
  
          return $uniqueFileName;
      }
code: public function createDummyZipArchive($fileName = 'test.zip', array $filesToAddToArchive = [])
      {
          $this->checkForZipArchive();
  
          $this->createDummyUploadFolder();
          $uniqueFileName = $this->getUniqueFileOrFolderPath($fileName);
          $zip = new ZipArchive();
  
          if ($zip->open($uniqueFileName, ZipArchive::CREATE) !== true) {
              throw new Exception('The new ZIP archive "' . $fileName . '" could not be created.', 1334439299);
          }
  
          $contents = !empty($filesToAddToArchive) ? $filesToAddToArchive : [$this->createDummyFile()];
  
          foreach ($contents as $pathToFile) {
              if (!file_exists($pathToFile)) {
                  throw new Exception(
                      'The provided path "' . $pathToFile . '" does not point to an existing file.',
                      1334439306
                  );
              }
              $zip->addFile($pathToFile, $this->getPathRelativeToUploadDirectory($pathToFile));
          }
  
          $zip->close();
          $this->addToDummyFileList($uniqueFileName);
  
          return $uniqueFileName;
      }
code_tokens: public function createDummyZipArchive ( $ fileName = 'test.zip' , array $ filesToAddToArchive = [ ] ) { $ this -> checkForZipArchive ( ) ; $ this -> createDummyUploadFolder ( ) ; $ uniqueFileName = $ this -> getUniqueFileOrFolderPath ( $ fileName ) ; $ zip = new ZipArchive ( ) ; if ( $ zip -> open ( $ uniqueFileName , ZipArchive :: CREATE ) !== true ) { throw new Exception ( 'The new ZIP archive "' . $ fileName . '" could not be created.' , 1334439299 ) ; } $ contents = ! empty ( $ filesToAddToArchive ) ? $ filesToAddToArchive : [ $ this -> createDummyFile ( ) ] ; foreach ( $ contents as $ pathToFile ) { if ( ! file_exists ( $ pathToFile ) ) { throw new Exception ( 'The provided path "' . $ pathToFile . '" does not point to an existing file.' , 1334439306 ) ; } $ zip -> addFile ( $ pathToFile , $ this -> getPathRelativeToUploadDirectory ( $ pathToFile ) ) ; } $ zip -> close ( ) ; $ this -> addToDummyFileList ( $ uniqueFileName ) ; return $ uniqueFileName ; }
docstring: Creates a dummy ZIP archive with a unique file name in the calling
  extension's upload directory.
  
  @param string $fileName
  path of the dummy ZIP archive to create, relative to the calling
  extension's upload directory, must not be empty
  @param string[] $filesToAddToArchive
  Absolute paths of the files to add to the ZIP archive. Note that
  the archives directory structure will be relative to the upload
  folder path, so only files within this folder or in sub-folders of
  this folder can be added.
  The provided array may be empty, but as ZIP archives cannot be
  empty, a content-less dummy text file will be added to the archive
  then.
  
  @return string
  the absolute path of the created dummy ZIP archive, will not be empty
  
  @throws Exception if the PHP installation does not provide ZIPArchive
docstring_tokens: Creates a dummy ZIP archive with a unique file name in the calling extension s upload directory .