Properties

$entries

$entries : \PhpZip\Model\ZipEntry[]

Type

ZipEntry[]

$archiveComment

$archiveComment : string|null

Type

string|null — Archive comment

$sourceContainer

$sourceContainer : \PhpZip\Model\ImmutableZipContainer|null

Type

ImmutableZipContainer|null — The source container contains zip entries from an open zip archive. The source container makes it possible to undo changes in the archive. When cloning, this container is not cloned.

$zipAlign

$zipAlign : int|null

Type

int|null — Apk zipalign value

Methods

__construct()

__construct(\PhpZip\Model\ImmutableZipContainer|null  $sourceContainer = null) : mixed

MutableZipContainer constructor.

Parameters

\PhpZip\Model\ImmutableZipContainer|null $sourceContainer

Returns

mixed —

getEntries()

& getEntries() : \PhpZip\Model\ZipEntry[]

Returns

\PhpZip\Model\ZipEntry[] —

getArchiveComment()

getArchiveComment() : string|null

Returns

string|null —

count()

count() : int

Count elements of an object.

Returns

int —

The custom count as an integer. The return value is cast to an integer.

__clone()

__clone() : mixed

When an object is cloned, PHP 5 will perform a shallow copy of all of the object's properties.

Any properties that are references to other variables, will remain references. Once the cloning is complete, if a __clone() method is defined, then the newly created object's __clone() method will be called, to allow any necessary properties that need to be changed. NOT CALLABLE DIRECTLY.

Returns

mixed —

getSourceContainer()

getSourceContainer() : \PhpZip\Model\ImmutableZipContainer|null

Returns

\PhpZip\Model\ImmutableZipContainer|null —

addEntry()

addEntry(\PhpZip\Model\ZipEntry  $entry) : mixed

Parameters

\PhpZip\Model\ZipEntry $entry

Returns

mixed —

deleteEntry()

deleteEntry(string|\PhpZip\Model\ZipEntry  $entry) : bool

Parameters

string|\PhpZip\Model\ZipEntry $entry

Returns

bool —

renameEntry()

renameEntry(string|\PhpZip\Model\ZipEntry  $old, string|\PhpZip\Model\ZipEntry  $new) : \PhpZip\Model\ZipEntry

Parameters

string|\PhpZip\Model\ZipEntry $old
string|\PhpZip\Model\ZipEntry $new

Throws

\PhpZip\Exception\ZipException

Returns

\PhpZip\Model\ZipEntry —

New zip entry

getEntry()

getEntry(string|\PhpZip\Model\ZipEntry  $entryName) : \PhpZip\Model\ZipEntry

Parameters

string|\PhpZip\Model\ZipEntry $entryName

Throws

\PhpZip\Exception\ZipEntryNotFoundException

Returns

\PhpZip\Model\ZipEntry —

getEntryOrNull()

getEntryOrNull(string|\PhpZip\Model\ZipEntry  $entryName) : \PhpZip\Model\ZipEntry|null

Parameters

string|\PhpZip\Model\ZipEntry $entryName

Returns

\PhpZip\Model\ZipEntry|null —

hasEntry()

hasEntry(string|\PhpZip\Model\ZipEntry  $entryName) : bool

Parameters

string|\PhpZip\Model\ZipEntry $entryName

Returns

bool —

deleteAll()

deleteAll() : mixed

Delete all entries.

Returns

mixed —

deleteByRegex()

deleteByRegex(string  $regexPattern) : \PhpZip\Model\ZipEntry[]

Delete entries by regex pattern.

Parameters

string $regexPattern

Regex pattern

Returns

\PhpZip\Model\ZipEntry[] —

Deleted entries

unchangeAll()

unchangeAll() : mixed

Undo all changes done in the archive.

Returns

mixed —

unchangeArchiveComment()

unchangeArchiveComment() : mixed

Undo change archive comment.

Returns

mixed —

unchangeEntry()

unchangeEntry(string|\PhpZip\Model\ZipEntry  $entry) : bool

Revert all changes done to an entry with the given name.

Parameters

string|\PhpZip\Model\ZipEntry $entry

Entry name or ZipEntry

Returns

bool —

sortByName()

sortByName(callable  $cmp) : mixed

Entries sort by name.

Example:

$zipContainer->sortByName(static function (string $nameA, string $nameB): int {
    return strcmp($nameA, $nameB);
});

Parameters

callable $cmp

Returns

mixed —

sortByEntry()

sortByEntry(callable  $cmp) : mixed

Entries sort by entry.

Example:

$zipContainer->sortByEntry(static function (ZipEntry $a, ZipEntry $b): int {
    return strcmp($a->getName(), $b->getName());
});

Parameters

callable $cmp

Returns

mixed —

setArchiveComment()

setArchiveComment(string|null  $archiveComment) : mixed

Parameters

string|null $archiveComment

Returns

mixed —

matcher()

matcher() : \PhpZip\Model\ZipEntryMatcher

Returns

\PhpZip\Model\ZipEntryMatcher —

setReadPassword()

setReadPassword(string|null  $password) : mixed

Specify a password for extracting files.

Parameters

string|null $password

Returns

mixed —

setReadPasswordEntry()

setReadPasswordEntry(string  $entryName, string  $password) : mixed

Parameters

string $entryName
string $password

Throws

\PhpZip\Exception\ZipEntryNotFoundException
\PhpZip\Exception\ZipException

Returns

mixed —

getZipAlign()

getZipAlign() : int|null

Returns

int|null —

setZipAlign()

setZipAlign(int|null  $zipAlign) : mixed

Parameters

int|null $zipAlign

Returns

mixed —

isZipAlign()

isZipAlign() : bool

Returns

bool —

setWritePassword()

setWritePassword(string|null  $writePassword) : mixed

Parameters

string|null $writePassword

Returns

mixed —

removePassword()

removePassword() : mixed

Remove password.

Returns

mixed —

removePasswordEntry()

removePasswordEntry(string|\PhpZip\Model\ZipEntry  $entryName) : mixed

Parameters

string|\PhpZip\Model\ZipEntry $entryName

Returns

mixed —

setEncryptionMethod()

setEncryptionMethod(int  $encryptionMethod = ZipEncryptionMethod::WINZIP_AES_256) : mixed

Parameters

int $encryptionMethod

Returns

mixed —