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