Update functions signature for compatibility with PHP 5.4

This commit is contained in:
Nicolas Le Goff
2012-10-23 18:01:21 +02:00
parent 3fb8949877
commit 52eb3ed48d

View File

@@ -61,7 +61,7 @@ class ZipArchiveImproved extends ZipArchive
* @param int $flags * @param int $flags
* return mixed * return mixed
*/ */
public function open($fileName, $flags) public function open($fileName, $flags = null)
{ {
$this->_archiveFileName = $fileName; $this->_archiveFileName = $fileName;
$this->_newAddedFilesCounter = 0; $this->_newAddedFilesCounter = 0;
@@ -106,26 +106,18 @@ class ZipArchiveImproved extends ZipArchive
* @param string [optional] $localname the name of the file in the ZIP archive * @param string [optional] $localname the name of the file in the ZIP archive
* @return bool * @return bool
*/ */
public function addFile($fileName) public function addFile($fileName, $localname = null, $start = 0, $length = 0)
{ {
if ($this->_newAddedFilesCounter >= $this->_newAddedFilesSize) { if ($this->_newAddedFilesCounter >= $this->_newAddedFilesSize) {
$this->reopen(); $this->reopen();
} }
if (func_num_args() > 1) {
$flags = func_get_arg(1);
$added = parent::addFile($fileName, $flags);
if ($added) {
$this->_newAddedFilesCounter ++;
}
return $added; $added = parent::addFile($fileName, $localname, $start, $length);
}
$added = parent::addFile($fileName);
if ($added) { if ($added) {
$this->_newAddedFilesCounter ++; $this->_newAddedFilesCounter ++;
} }
return $added; return $added;
} }
// public function addFile()
} }