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