1
0
mirror of https://github.com/Ne-Lexa/php-zip.git synced 2025-10-11 13:24:28 +02:00

PHP-doc updated (@throws added everywhere) and minor refactoring done.

This commit is contained in:
wapplay
2018-10-09 10:06:04 +03:00
parent 59773d62a8
commit f9e6a73587
38 changed files with 942 additions and 684 deletions

View File

@@ -3,7 +3,6 @@
namespace PhpZip\Model\Entry;
use PhpZip\Exception\InvalidArgumentException;
use PhpZip\Exception\ZipException;
use PhpZip\ZipFileInterface;
/**
@@ -27,7 +26,6 @@ class ZipNewEntry extends ZipAbstractEntry
/**
* ZipNewEntry constructor.
* @param string|resource|null $content
* @throws InvalidArgumentException
*/
public function __construct($content = null)
{
@@ -42,12 +40,12 @@ class ZipNewEntry extends ZipAbstractEntry
* Returns an string content of the given entry.
*
* @return null|string
* @throws ZipException
*/
public function getEntryContent()
{
if (is_resource($this->content)) {
return stream_get_contents($this->content, -1, 0);
rewind($this->content);
return stream_get_contents($this->content);
}
return $this->content;
}
@@ -81,7 +79,7 @@ class ZipNewEntry extends ZipAbstractEntry
public function __destruct()
{
if (!$this->clone && null !== $this->content && is_resource($this->content)) {
if (!$this->clone && $this->content !== null && is_resource($this->content)) {
fclose($this->content);
$this->content = null;
}