1 | <?php |
||
15 | class Zip implements Adapter |
||
16 | { |
||
17 | /** |
||
18 | * @var string The zip archive full path |
||
19 | */ |
||
20 | protected $zipFile; |
||
21 | |||
22 | /** |
||
23 | * @var ZipArchive |
||
24 | */ |
||
25 | protected $zipArchive; |
||
26 | |||
27 | public function __construct($zipFile) |
||
39 | |||
40 | /** |
||
41 | * {@inheritdoc} |
||
42 | */ |
||
43 | public function read($key) |
||
51 | |||
52 | /** |
||
53 | * {@inheritdoc} |
||
54 | */ |
||
55 | public function write($key, $content) |
||
67 | |||
68 | /** |
||
69 | * {@inheritdoc} |
||
70 | */ |
||
71 | public function exists($key) |
||
75 | |||
76 | /** |
||
77 | * {@inheritdoc} |
||
78 | */ |
||
79 | public function keys() |
||
89 | |||
90 | /** |
||
91 | * @todo implement |
||
92 | * |
||
93 | * {@inheritdoc} |
||
94 | */ |
||
95 | public function isDirectory($key) |
||
99 | |||
100 | /** |
||
101 | * {@inheritdoc} |
||
102 | */ |
||
103 | public function mtime($key) |
||
104 | { |
||
105 | $stat = $this->getStat($key); |
||
106 | |||
107 | return $stat['mtime'] ?? false; |
||
108 | } |
||
109 | |||
110 | /** |
||
111 | * {@inheritdoc} |
||
112 | */ |
||
113 | public function delete($key) |
||
121 | |||
122 | /** |
||
123 | * {@inheritdoc} |
||
124 | */ |
||
125 | public function rename($sourceKey, $targetKey) |
||
133 | |||
134 | /** |
||
135 | * Returns the stat of a file in the zip archive |
||
136 | * (name, index, crc, mtime, compression size, compression method, filesize). |
||
137 | * |
||
138 | * @param $key |
||
139 | * |
||
140 | * @return array|bool |
||
141 | */ |
||
142 | public function getStat($key) |
||
151 | |||
152 | public function __destruct() |
||
162 | |||
163 | protected function reinitZipArchive() |
||
216 | |||
217 | /** |
||
218 | * Saves archive modifications and updates current ZipArchive instance. |
||
219 | * |
||
220 | * @throws \RuntimeException If file could not be saved |
||
221 | */ |
||
222 | protected function save() |
||
234 | } |
||
235 |