Pull merge.
[yaffs-website] / vendor / alchemy / zippy / src / Archive / ArchiveInterface.php
1 <?php
2
3 /*
4  * This file is part of Zippy.
5  *
6  * (c) Alchemy <info@alchemy.fr>
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\Archive;
13
14 use Alchemy\Zippy\Exception\RuntimeException;
15 use Alchemy\Zippy\Exception\InvalidArgumentException;
16
17 interface ArchiveInterface extends \IteratorAggregate, \Countable
18 {
19     /**
20      * Adds a file or a folder into the archive
21      *
22      * @param string|array|\SplFileInfo $sources   The path to the file or a folder
23      * @param bool                      $recursive Recurse into sub-directories
24      *
25      * @return ArchiveInterface
26      *
27      * @throws InvalidArgumentException In case the provided source path is not valid
28      * @throws RuntimeException         In case of failure
29      */
30     public function addMembers($sources, $recursive = true);
31
32     /**
33      * Removes a file from the archive
34      *
35      * @param string|array $sources The path to an archive or a folder member
36      *
37      * @return ArchiveInterface
38      *
39      * @throws RuntimeException In case of failure
40      */
41     public function removeMembers($sources);
42
43     /**
44      * Lists files and directories archive members
45      *
46      * @return MemberInterface[] An array of File
47      *
48      * @throws RuntimeException In case archive could not be read
49      */
50     public function getMembers();
51
52     /**
53      * Extracts current archive to the given directory
54      *
55      * @param string $toDirectory The path the extracted archive
56      *
57      * @return ArchiveInterface
58      *
59      * @throws RuntimeException In case archive could not be extracted
60      */
61     public function extract($toDirectory);
62
63     /**
64      * Extracts specific members from the archive
65      *
66      * @param string|MemberInterface[] $members     An array of members path
67      * @param string                   $toDirectory The destination $directory
68      *
69      * @return ArchiveInterface
70      *
71      * @throws RuntimeException In case member could not be extracted
72      */
73     public function extractMembers($members, $toDirectory = null);
74 }