Zippy API
Interface

Alchemy\Zippy\Archive\ArchiveInterface

interface ArchiveInterface implements IteratorAggregate, Countable

Methods

ArchiveInterface addMembers(String|Array|SplFileInfo $sources, Boolean $recursive = true)

Adds a file or a folder into the archive

ArchiveInterface removeMembers(String|Array $sources)

Removes a file from the archive

Array getMembers()

Lists files and directories archive members

ArchiveInterface extract(String $toDirectory)

Extracts current archive to the given directory

ArchiveInterface extractMembers(String|Array $members, string $toDirectory = null)

Extracts specific members from the archive

Details

at line 30
public ArchiveInterface addMembers(String|Array|SplFileInfo $sources, Boolean $recursive = true)

Adds a file or a folder into the archive

Parameters

String|Array|SplFileInfo $sources The path to the file or a folder
Boolean $recursive Recurse into sub-directories

Return Value

ArchiveInterface

Exceptions

InvalidArgumentException In case the provided source path is not valid
RuntimeException In case of failure

at line 41
public ArchiveInterface removeMembers(String|Array $sources)

Removes a file from the archive

Parameters

String|Array $sources The path to an archive or a folder member

Return Value

ArchiveInterface

Exceptions

RuntimeException In case of failure

at line 50
public Array getMembers()

Lists files and directories archive members

Return Value

Array An array of File

Exceptions

RuntimeException In case archive could not be read

at line 61
public ArchiveInterface extract(String $toDirectory)

Extracts current archive to the given directory

Parameters

String $toDirectory The path the extracted archive

Return Value

ArchiveInterface

Exceptions

RuntimeException In case archive could not be extracted

at line 73
public ArchiveInterface extractMembers(String|Array $members, string $toDirectory = null)

Extracts specific members from the archive

Parameters

String|Array $members An array of members path
string $toDirectory The destination $directory

Return Value

ArchiveInterface

Exceptions

RuntimeException In case member could not be extracted