wapplay 7 лет назад
Родитель
Сommit
c9f597308e
3 измененных файлов с 16 добавлено и 16 удалено
  1. 5 5
      src/PhpZip/Model/Entry/ZipNewFileEntry.php
  2. 4 4
      src/PhpZip/ZipFile.php
  3. 7 7
      tests/PhpZip/Issue24Test.php

+ 5 - 5
src/PhpZip/Model/Entry/ZipNewFileEntry.php

@@ -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);
     }
-}
+}

+ 4 - 4
src/PhpZip/ZipFile.php

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

+ 7 - 7
tests/PhpZip/Issue24Test.php

@@ -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);
     }
-}
+}