ArchiverInterface.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. namespace Drupal\Core\Archiver;
  3. /**
  4. * Defines the common interface for all Archiver classes.
  5. *
  6. * @see \Drupal\Core\Archiver\ArchiverManager
  7. * @see \Drupal\Core\Archiver\Annotation\Archiver
  8. * @see plugin_api
  9. */
  10. interface ArchiverInterface {
  11. /**
  12. * Adds the specified file or directory to the archive.
  13. *
  14. * @param string $file_path
  15. * The full system path of the file or directory to add. Only local files
  16. * and directories are supported.
  17. *
  18. * @return \Drupal\Core\Archiver\ArchiverInterface
  19. * The called object.
  20. */
  21. public function add($file_path);
  22. /**
  23. * Removes the specified file from the archive.
  24. *
  25. * @param string $path
  26. * The file name relative to the root of the archive to remove.
  27. *
  28. * @return \Drupal\Core\Archiver\ArchiverInterface
  29. * The called object.
  30. */
  31. public function remove($path);
  32. /**
  33. * Extracts multiple files in the archive to the specified path.
  34. *
  35. * @param string $path
  36. * A full system path of the directory to which to extract files.
  37. * @param array $files
  38. * Optionally specify a list of files to be extracted. Files are
  39. * relative to the root of the archive. If not specified, all files
  40. * in the archive will be extracted.
  41. *
  42. * @return \Drupal\Core\Archiver\ArchiverInterface
  43. * The called object.
  44. */
  45. public function extract($path, array $files = []);
  46. /**
  47. * Lists all files in the archive.
  48. *
  49. * @return array
  50. * An array of file names relative to the root of the archive.
  51. */
  52. public function listContents();
  53. }