interface ArchiverInterface (View source)

Defines the common interface for all Archiver classes.

Methods

$this
add(string $file_path)

Adds the specified file or directory to the archive.

$this
remove(string $path)

Removes the specified file from the archive.

$this
extract(string $path, array $files = [])

Extracts multiple files in the archive to the specified path.

array
listContents()

Lists all files in the archive.

Details

$this add(string $file_path)

Adds the specified file or directory to the archive.

Parameters

string $file_path

The full system path of the file or directory to add. Only local files and directories are supported.

Return Value

$this

The called object.

$this remove(string $path)

Removes the specified file from the archive.

Parameters

string $path

The file name relative to the root of the archive to remove.

Return Value

$this

The called object.

$this extract(string $path, array $files = [])

Extracts multiple files in the archive to the specified path.

Parameters

string $path

A full system path of the directory to which to extract files.

array $files

Optionally specify a list of files to be extracted. Files are relative to the root of the archive. If not specified, all files in the archive will be extracted.

Return Value

$this

The called object.

array listContents()

Lists all files in the archive.

Return Value

array

An array of file names relative to the root of the archive.