1 | <?php |
||
37 | abstract class DriverAbstract extends ObjectAbstract implements DriverInterface, ErrorAwareInterface, ExtensionAwareInterface |
||
38 | { |
||
39 | use ErrorAwareTrait, ExtensionAwareTrait; |
||
40 | |||
41 | /** |
||
42 | * Store meta data in a seperate file |
||
43 | * |
||
44 | * @var bool |
||
45 | * @access protected |
||
46 | */ |
||
47 | protected $use_metafile = false; |
||
48 | |||
49 | /** |
||
50 | * {@inheritDoc} |
||
51 | */ |
||
52 | public function exists(/*# string */ $path)/*# : bool */ |
||
57 | |||
58 | /** |
||
59 | * {@inheritDoc} |
||
60 | */ |
||
61 | public function getContent(/*# string */ $path, /*# bool */ $stream = false) |
||
74 | |||
75 | /** |
||
76 | * {@inheritDoc} |
||
77 | */ |
||
78 | public function getMeta(/*# string */ $path)/*# : array */ |
||
93 | |||
94 | /** |
||
95 | * {@inheritDoc} |
||
96 | */ |
||
97 | public function setContent(/*# string */ $path, $content)/*# : bool */ |
||
115 | |||
116 | /** |
||
117 | * {@inheritDoc} |
||
118 | */ |
||
119 | public function setMeta(/*# string */ $path, array $meta)/*# : bool */ |
||
135 | |||
136 | /** |
||
137 | * {@inheritDoc} |
||
138 | */ |
||
139 | public function isDir(/*# string */ $path)/*# : bool */ |
||
144 | |||
145 | /** |
||
146 | * {@inheritDoc} |
||
147 | */ |
||
148 | public function rename(/*# string */ $from, /*# string */ $to)/*# : bool */ |
||
174 | |||
175 | /** |
||
176 | * {@inheritDoc} |
||
177 | */ |
||
178 | public function copy(/*# string */ $from, /*# string */ $to)/*# : bool */ |
||
197 | |||
198 | /** |
||
199 | * {@inheritDoc} |
||
200 | */ |
||
201 | public function delete(/*# string */ $path)/*# : bool */ |
||
214 | |||
215 | /** |
||
216 | * Returns driver specific real path |
||
217 | * @param string $path |
||
218 | * @return string |
||
219 | * @access protected |
||
220 | */ |
||
221 | abstract protected function realPath(/*# string */ $path)/*# : string */; |
||
222 | |||
223 | /** |
||
224 | * Exists of real path |
||
225 | * |
||
226 | * @param string $realPath |
||
227 | * @return bool |
||
228 | * @access protected |
||
229 | */ |
||
230 | abstract protected function realExists(/*# string */ $realPath)/*# : bool */; |
||
231 | |||
232 | /** |
||
233 | * Is path a directory |
||
234 | * |
||
235 | * @param string $realPath |
||
236 | * @return bool |
||
237 | * @access protected |
||
238 | */ |
||
239 | abstract protected function isRealDir(/*# string */ $realPath)/*# : bool */; |
||
240 | |||
241 | /** |
||
242 | * Read directory, returns an array of paths in this directory |
||
243 | * |
||
244 | * @param string $realPath |
||
245 | * @param string $prefix prefix to prepend to the results |
||
246 | * @return array |
||
247 | * @access protected |
||
248 | */ |
||
249 | abstract protected function readDir( |
||
253 | |||
254 | /** |
||
255 | * create directory |
||
256 | * |
||
257 | * @param string $realPath |
||
258 | * @access protected |
||
259 | */ |
||
260 | abstract protected function makeDirectory( |
||
263 | |||
264 | /** |
||
265 | * Open read stream |
||
266 | * |
||
267 | * @param string $realPath |
||
268 | * @return resource|null |
||
269 | * @access protected |
||
270 | */ |
||
271 | abstract protected function openReadStream(/*# string */ $realPath); |
||
272 | |||
273 | /** |
||
274 | * Read file and returns all the content |
||
275 | * |
||
276 | * @param string $realPath |
||
277 | * @return string|null |
||
278 | * @access protected |
||
279 | */ |
||
280 | abstract protected function readFile(/*# string */ $realPath); |
||
281 | |||
282 | /** |
||
283 | * Get the meta data |
||
284 | * |
||
285 | * @param string $realPath |
||
286 | * @return array |
||
287 | * @access protected |
||
288 | */ |
||
289 | abstract protected function getRealMeta(/*# string */ $realPath)/*# : array */; |
||
290 | |||
291 | /** |
||
292 | * Make sure path directory exits. |
||
293 | * |
||
294 | * @param string $realPath |
||
295 | * @return bool |
||
296 | * @access protected |
||
297 | */ |
||
298 | abstract protected function ensurePath(/*# string */ $realPath)/*# : bool */; |
||
299 | |||
300 | /** |
||
301 | * Write to file from stream |
||
302 | * |
||
303 | * @param string $realPath |
||
304 | * @param resource $resource |
||
305 | * @return bool |
||
306 | * @access protected |
||
307 | */ |
||
308 | abstract protected function writeStream( |
||
312 | |||
313 | /** |
||
314 | * Write to file |
||
315 | * |
||
316 | * @param string $realPath |
||
317 | * @param string $content |
||
318 | * @return bool |
||
319 | * @access protected |
||
320 | */ |
||
321 | abstract protected function writeFile( |
||
325 | |||
326 | /** |
||
327 | * Write meta data |
||
328 | * |
||
329 | * @param string $realPath |
||
330 | * @param array $meta |
||
331 | * @return bool |
||
332 | * @access protected |
||
333 | */ |
||
334 | abstract protected function setRealMeta( |
||
338 | |||
339 | /** |
||
340 | * Rename directory |
||
341 | * |
||
342 | * @param string $from |
||
343 | * @param string $to |
||
344 | * @return bool |
||
345 | * @access protected |
||
346 | */ |
||
347 | abstract protected function renameDir( |
||
351 | |||
352 | /** |
||
353 | * Rename file |
||
354 | * |
||
355 | * @param string $from |
||
356 | * @param string $to |
||
357 | * @return bool |
||
358 | * @access protected |
||
359 | */ |
||
360 | abstract protected function renameFile( |
||
364 | |||
365 | /** |
||
366 | * Copy directory |
||
367 | * |
||
368 | * @param string $from |
||
369 | * @param string $to |
||
370 | * @return bool |
||
371 | * @access protected |
||
372 | */ |
||
373 | abstract protected function copyDir( |
||
377 | |||
378 | /** |
||
379 | * Copy file |
||
380 | * |
||
381 | * @param string $from |
||
382 | * @param string $to |
||
383 | * @return bool |
||
384 | * @access protected |
||
385 | */ |
||
386 | abstract protected function copyFile( |
||
390 | |||
391 | /** |
||
392 | * Delete directory |
||
393 | * |
||
394 | * @param string $realPath |
||
395 | * @return bool |
||
396 | * @access protected |
||
397 | */ |
||
398 | abstract protected function deleteDir(/*# string */ $realPath)/*# : bool */; |
||
399 | |||
400 | /** |
||
401 | * Delete the file |
||
402 | * |
||
403 | * @param string $realPath |
||
404 | * @return bool |
||
405 | * @access protected |
||
406 | */ |
||
407 | abstract protected function deleteFile(/*# string */ $realPath)/*# : bool */; |
||
408 | } |
||
409 |