mirror of
https://github.com/Ne-Lexa/php-zip.git
synced 2025-10-19 00:56:25 +02:00
Easy to initialize the output zip file.
This commit is contained in:
@@ -157,6 +157,13 @@ class ZipFile implements \Countable, \ArrayAccess, \Iterator, ZipConstants
|
||||
return $zipFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ZipOutputFile
|
||||
*/
|
||||
public function edit(){
|
||||
return ZipOutputFile::openFromZipFile($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check zip file signature
|
||||
*
|
||||
|
@@ -152,6 +152,22 @@ class ZipOutputFile implements \Countable, \ArrayAccess, \Iterator, ZipConstants
|
||||
return new self($zipFile);
|
||||
}
|
||||
|
||||
/**
|
||||
* Open zip file from update.
|
||||
*
|
||||
* @param string $filename
|
||||
* @return ZipOutputFile
|
||||
* @throws IllegalArgumentException
|
||||
* @see ZipOutputFile::__construct()
|
||||
*/
|
||||
public static function openFromFile($filename)
|
||||
{
|
||||
if (empty($filename)) {
|
||||
throw new IllegalArgumentException("Zip file is null");
|
||||
}
|
||||
return new self(ZipFile::openFromFile($filename));
|
||||
}
|
||||
|
||||
/**
|
||||
* Count zip entries.
|
||||
*
|
||||
|
Reference in New Issue
Block a user