Pull merge.
[yaffs-website] / vendor / alchemy / zippy / src / Archive / MemberInterface.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\Adapter\Resource\ResourceInterface;
15 use Alchemy\Zippy\Exception\InvalidArgumentException;
16 use Alchemy\Zippy\Exception\RuntimeException;
17
18 interface MemberInterface
19 {
20     /**
21      * Gets the location of an archive member
22      *
23      * @return string
24      */
25     public function getLocation();
26
27     /**
28      * Tells whether the member is a directory or not
29      *
30      * @return bool
31      */
32     public function isDir();
33
34     /**
35      * Returns the last modified date of the member
36      *
37      * @return \DateTime
38      */
39     public function getLastModifiedDate();
40
41     /**
42      * Returns the (uncompressed) size of the member
43      *
44      * If the size is unknown, returns -1
45      *
46      * @return integer
47      */
48     public function getSize();
49
50     /**
51      * Extract the member from its archive
52      *
53      * Be careful using this method within a loop
54      * This will execute one extraction process for each file
55      * Prefer the use of ArchiveInterface::extractMembers in that use case
56      *
57      * @param string|null $to        The path where to extract the member, if no path is not provided the member is extracted in the same directory of its archive
58      * @param bool        $overwrite Whether to overwrite destination file if it already exists. Defaults to false
59      *
60      * @return \SplFileInfo The extracted file
61      *
62      * @throws RuntimeException In case of failure
63      * @throws InvalidArgumentException In case no members could be removed or provide extract target directory is not valid
64      */
65     public function extract($to = null, $overwrite = false);
66     
67     /**
68      * Get resource.
69      * 
70      * @return ResourceInterface
71      * */
72     public function getResource();
73     
74     /**
75      * @inheritdoc
76      */
77     public function __toString();
78 }