API
Class

Elibyy\Creator

class Creator extends Reader

Class Creator this class is just removing the file existent check

Methods

__construct(string $file)

initiate a new instance of the creator with the file specified

Adapter getAdapter()

returns the current adapter instance provided by {@link Reader#_getAdapter(string $file)}

from Reader
mixed unzip(string $destination = null, string|array $entries = null)

from Reader
string getFilename()

this function returns the loaded archive name from the adapter

from Reader
mixed getArchive()

returns the archive object from the adapter

from Reader
File[] getFiles()

returns an array of {@link File} object to iterate on

from Reader
int getFilesCount()

returns the number of files in the archive

from Reader
string getComment()

returns the archive comment from the adapter

from Reader
Adapter setComment(string $comment)

from Reader
Adapter addFolder(string $path, string $parent = null)

adds a new folder to the archive recursively

from Reader
bool addFile(string $path, string $localName = null, int $start, int $length = null)

adds a new file into the archive

from Reader
Adapter updateArchive()

refreshes the archive in the adapter

from Reader
bool removeFileByObject(File $file)

removes a file from the archive using a {@link File} Object

from Reader
bool removeFileByName(string $name)

removes a file from the archive using the file name in the archive

from Reader
bool addGlob(string $glob, int $flags = GLOB_BRACE, array $options = array())

adds files using

from Reader
bool addPattern(string $pattern, string $directory, array $options = array())

from Reader
Adapter compress(string $format)

creates a new archive from the current archive with the new format specified

from Reader

Details

at line 32
public __construct(string $file)

initiate a new instance of the creator with the file specified

Parameters

string $file the file to load with the reader

Exceptions

RuntimeException if no adapter found

in Reader at line 113
public Adapter getAdapter()

returns the current adapter instance provided by {@link Reader#_getAdapter(string $file)}

Return Value

Adapter the current adapter instance

in Reader at line 127
public mixed unzip(string $destination = null, string|array $entries = null)

Parameters

string $destination the destination folder to unzip to
string|array $entries the specific entries to extract from the archive can be either
a specific file (string) or an array for files

Return Value

mixed

in Reader at line 138
public string getFilename()

this function returns the loaded archive name from the adapter

Return Value

string the archive filename

in Reader at line 149
public mixed getArchive()

returns the archive object from the adapter

Return Value

mixed the archive received from the adapter

in Reader at line 160
public File[] getFiles()

returns an array of {@link File} object to iterate on

Return Value

File[] the array of the files in the archive

in Reader at line 171
public int getFilesCount()

returns the number of files in the archive

Return Value

int the total files in the archive

in Reader at line 182
public string getComment()

returns the archive comment from the adapter

Return Value

string the archive comment

in Reader at line 193
public Adapter setComment(string $comment)

Parameters

string $comment the new comment to set to the archive

Return Value

Adapter

in Reader at line 207
public Adapter addFolder(string $path, string $parent = null)

adds a new folder to the archive recursively

Parameters

string $path the full path of the directory in the file system
string $parent the relative path of the parent in the archive

Return Value

Adapter the adapter instance

in Reader at line 223
public bool addFile(string $path, string $localName = null, int $start, int $length = null)

adds a new file into the archive

Parameters

string $path the full path of the file in the file system
string $localName the local name of the file in the archive
int $start the start point to read from the file
int $length the end point to read from the file

Return Value

bool was the file added?

in Reader at line 234
public Adapter updateArchive()

refreshes the archive in the adapter

Return Value

Adapter the adapter with updated archive

in Reader at line 247
public bool removeFileByObject(File $file)

removes a file from the archive using a {@link File} Object

Parameters

File $file the File Object to remove

Return Value

bool was the file removed?

in Reader at line 260
public bool removeFileByName(string $name)

removes a file from the archive using the file name in the archive

Parameters

string $name the file name

Return Value

bool was the file removed?

in Reader at line 284
public bool addGlob(string $glob, int $flags = GLOB_BRACE, array $options = array())

adds files using

Parameters

string $glob the glob pattern
int $flags glob flags
array $options An associative array of options. Available options are:

"addpath"

Prefix to prepend when translating to the local path of the file within the archive. This is applied after any remove operations defined by the "removepath" or "removeallpath" options.

Return Value

bool was glob added?

in Reader at line 298
public bool addPattern(string $pattern, string $directory, array $options = array())

Parameters

string $pattern the regular expression pattern
string $directory the path of the directory
array $options An associative array of options accepted by ZipArchive::addGlob.

Return Value

bool was pattern added?

in Reader at line 311
public Adapter compress(string $format)

creates a new archive from the current archive with the new format specified

Parameters

string $format the format of the compression

Return Value

Adapter the resulting adapter