|
| 1 | +<?php |
| 2 | + |
| 3 | +/* |
| 4 | + * This file is part of Zippy. |
| 5 | + * |
| 6 | + |
| 7 | + * |
| 8 | + * For the full copyright and license information, please view the LICENSE |
| 9 | + * file that was distributed with this source code. |
| 10 | + */ |
| 11 | + |
| 12 | +namespace Alchemy\Zippy; |
| 13 | + |
| 14 | +use Alchemy\Zippy\Exception\InvalidArgumentException; |
| 15 | +use Alchemy\Zippy\Exception\RuntimeException; |
| 16 | +use Alchemy\Zippy\FileInterface; |
| 17 | + |
| 18 | +interface ArchiveInterface |
| 19 | +{ |
| 20 | + /** |
| 21 | + * Adds a file into the archive |
| 22 | + * |
| 23 | + * @param String|\SplFileInfo $source The path to the file |
| 24 | + * @param String|null $target The archive file path, null to use the same as source |
| 25 | + * |
| 26 | + * @return ArchiveInterface |
| 27 | + * |
| 28 | + * @throws InvalidArgumentException In case the provided source path is not valid |
| 29 | + * @throws RuntimeException In case of failure |
| 30 | + */ |
| 31 | + public function add($source, $target = null); |
| 32 | + |
| 33 | + /** |
| 34 | + * Adds a directory into the archive |
| 35 | +
|
| 36 | + * @param String|\SplFileInfo $source The path to the directory |
| 37 | + * @param String|null $target The directory file path, null to use the same as source |
| 38 | + * @param Boolean $recursive Recurse into directories |
| 39 | + * |
| 40 | + * @return ArchiveInterface |
| 41 | + * |
| 42 | + * @throws InvalidArgumentException In case the provided source path is not valid |
| 43 | + * @throws RuntimeException In case of failure |
| 44 | + */ |
| 45 | + public function addDirectory($source, $target = null, $recursive = true); |
| 46 | + |
| 47 | + /** |
| 48 | + * Removes a file from the archive |
| 49 | + * |
| 50 | + * @param FileInterface $file The file to remove |
| 51 | + * |
| 52 | + * @return ArchiveInterface |
| 53 | + * |
| 54 | + * @throws RuntimeException In case of failure |
| 55 | + */ |
| 56 | + public function remove(FileInterface $file); |
| 57 | +} |
0 commit comments