1
0
mirror of https://github.com/Ne-Lexa/php-zip.git synced 2025-07-31 12:40:09 +02:00
This commit is contained in:
wapplay
2018-10-21 19:30:45 +03:00
parent 837454ba7e
commit c9f597308e
3 changed files with 16 additions and 16 deletions

View File

@@ -25,14 +25,14 @@ class ZipNewFileEntry extends ZipAbstractEntry
public function __construct($file)
{
parent::__construct();
if ($file === null){
if ($file === null) {
throw new InvalidArgumentException("file is null");
}
$file = (string)$file;
if (!is_file($file)){
if (!is_file($file)) {
throw new ZipException("File $file does not exist.");
}
if (!is_readable($file)){
if (!is_readable($file)) {
throw new ZipException("The '$file' file could not be read. Check permissions.");
}
$this->file = $file;
@@ -45,9 +45,9 @@ class ZipNewFileEntry extends ZipAbstractEntry
*/
public function getEntryContent()
{
if (!is_file($this->file)){
if (!is_file($this->file)) {
throw new RuntimeException("File {$this->file} does not exist.");
}
return file_get_contents($this->file);
}
}
}

View File

@@ -562,7 +562,7 @@ class ZipFile implements ZipFileInterface
throw new InvalidArgumentException('The input directory is not specified');
}
if (!is_dir($inputDir)) {
throw new InvalidArgumentException(sprintf('The "%s" directory does not exist.', $inputDir));
throw new InvalidArgumentException(sprintf('The "%s" directory does not exist.', $inputDir));
}
$inputDir = rtrim($inputDir, '/\\') . DIRECTORY_SEPARATOR;
@@ -594,7 +594,7 @@ class ZipFile implements ZipFileInterface
throw new InvalidArgumentException('The input directory is not specified');
}
if (!is_dir($inputDir)) {
throw new InvalidArgumentException(sprintf('The "%s" directory does not exist.', $inputDir));
throw new InvalidArgumentException(sprintf('The "%s" directory does not exist.', $inputDir));
}
$inputDir = rtrim($inputDir, '/\\') . DIRECTORY_SEPARATOR;
@@ -713,7 +713,7 @@ class ZipFile implements ZipFileInterface
throw new InvalidArgumentException('The input directory is not specified');
}
if (!is_dir($inputDir)) {
throw new InvalidArgumentException(sprintf('The "%s" directory does not exist.', $inputDir));
throw new InvalidArgumentException(sprintf('The "%s" directory does not exist.', $inputDir));
}
$globPattern = (string)$globPattern;
if (empty($globPattern)) {
@@ -813,7 +813,7 @@ class ZipFile implements ZipFileInterface
throw new InvalidArgumentException('The input directory is not specified');
}
if (!is_dir($inputDir)) {
throw new InvalidArgumentException(sprintf('The "%s" directory does not exist.', $inputDir));
throw new InvalidArgumentException(sprintf('The "%s" directory does not exist.', $inputDir));
}
$inputDir = rtrim($inputDir, '/\\') . DIRECTORY_SEPARATOR;

View File

@@ -53,7 +53,7 @@ class DummyFileSystemStream
*/
private $fp;
function stream_open($path, $mode, $options, &$opened_path)
public function stream_open($path, $mode, $options, &$opened_path)
{
// echo "DummyFileSystemStream->stream_open($path, $mode, $options)" . PHP_EOL;
@@ -64,7 +64,7 @@ class DummyFileSystemStream
return true;
}
function stream_read($count)
public function stream_read($count)
{
// echo "DummyFileSystemStream->stream_read($count)" . PHP_EOL;
$position = ftell($this->fp);
@@ -77,28 +77,28 @@ class DummyFileSystemStream
return $ret;
}
function stream_tell()
public function stream_tell()
{
// echo "DummyFileSystemStream->stream_tell()" . PHP_EOL;
return ftell($this->fp);
}
function stream_eof()
public function stream_eof()
{
// echo "DummyFileSystemStream->stream_eof()" . PHP_EOL;
$isfeof = feof($this->fp);
return $isfeof;
}
function stream_seek($offset, $whence)
public function stream_seek($offset, $whence)
{
// echo "DummyFileSystemStream->stream_seek($offset, $whence)" . PHP_EOL;
fseek($this->fp, $offset, $whence);
}
function stream_stat()
public function stream_stat()
{
// echo "DummyFileSystemStream->stream_stat()" . PHP_EOL;
return fstat($this->fp);
}
}
}