1
0
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:
wapplay-home-linux
2017-03-02 00:16:09 +03:00
parent 8d140cc1a1
commit 58e9f4bf73
5 changed files with 50 additions and 9 deletions

View File

@@ -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
*

View File

@@ -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.
*