1 | <?php |
||
33 | abstract class Archive{ |
||
34 | /** |
||
35 | * Open any of the supported archive types |
||
36 | * |
||
37 | * @param string $path |
||
38 | * @return Archive|void |
||
39 | */ |
||
40 | public static function open($path) { |
||
52 | |||
53 | /** |
||
54 | * @param $source |
||
55 | */ |
||
56 | abstract function __construct($source); |
||
57 | /** |
||
58 | * add an empty folder to the archive |
||
59 | * @param string $path |
||
60 | * @return bool |
||
61 | */ |
||
62 | abstract function addFolder($path); |
||
63 | /** |
||
64 | * add a file to the archive |
||
65 | * @param string $path |
||
66 | * @param string $source either a local file or string data |
||
67 | * @return bool |
||
68 | */ |
||
69 | abstract function addFile($path, $source=''); |
||
70 | /** |
||
71 | * rename a file or folder in the archive |
||
72 | * @param string $source |
||
73 | * @param string $dest |
||
74 | * @return bool |
||
75 | */ |
||
76 | abstract function rename($source, $dest); |
||
77 | /** |
||
78 | * get the uncompressed size of a file in the archive |
||
79 | * @param string $path |
||
80 | * @return int |
||
81 | */ |
||
82 | abstract function filesize($path); |
||
83 | /** |
||
84 | * get the last modified time of a file in the archive |
||
85 | * @param string $path |
||
86 | * @return int |
||
87 | */ |
||
88 | abstract function mtime($path); |
||
89 | /** |
||
90 | * get the files in a folder |
||
91 | * @param string $path |
||
92 | * @return array |
||
93 | */ |
||
94 | abstract function getFolder($path); |
||
95 | /** |
||
96 | * get all files in the archive |
||
97 | * @return array |
||
98 | */ |
||
99 | abstract function getFiles(); |
||
100 | /** |
||
101 | * get the content of a file |
||
102 | * @param string $path |
||
103 | * @return string |
||
104 | */ |
||
105 | abstract function getFile($path); |
||
106 | /** |
||
107 | * extract a single file from the archive |
||
108 | * @param string $path |
||
109 | * @param string $dest |
||
110 | * @return bool |
||
111 | */ |
||
112 | abstract function extractFile($path, $dest); |
||
113 | /** |
||
114 | * extract the archive |
||
115 | * @param string $dest |
||
116 | * @return bool |
||
117 | */ |
||
118 | abstract function extract($dest); |
||
119 | /** |
||
120 | * check if a file or folder exists in the archive |
||
121 | * @param string $path |
||
122 | * @return bool |
||
123 | */ |
||
124 | abstract function fileExists($path); |
||
125 | /** |
||
126 | * remove a file or folder from the archive |
||
127 | * @param string $path |
||
128 | * @return bool |
||
129 | */ |
||
130 | abstract function remove($path); |
||
131 | /** |
||
132 | * get a file handler |
||
133 | * @param string $path |
||
134 | * @param string $mode |
||
135 | * @return resource |
||
136 | */ |
||
137 | abstract function getStream($path, $mode); |
||
138 | /** |
||
139 | * add a folder and all its content |
||
140 | * @param string $path |
||
141 | * @param string $source |
||
142 | * @return boolean|null |
||
143 | */ |
||
144 | function addRecursive($path, $source) { |
||
160 | } |
||
161 |