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:
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user