@@ -18,8 +18,9 @@ discard block |
||
| 18 | 18 | */ |
| 19 | 19 | public static function registerWrapper() |
| 20 | 20 | { |
| 21 | - if (!self::$registered) |
|
| 22 | - stream_wrapper_register('compress.lzw', __CLASS__); |
|
| 21 | + if (!self::$registered) { |
|
| 22 | + stream_wrapper_register('compress.lzw', __CLASS__); |
|
| 23 | + } |
|
| 23 | 24 | self::$registered = true; |
| 24 | 25 | } |
| 25 | 26 | |
@@ -50,12 +51,14 @@ discard block |
||
| 50 | 51 | { |
| 51 | 52 | // check for compress & uncompress utility |
| 52 | 53 | $this->checkBinary(); |
| 53 | - if (self::$installed === false) |
|
| 54 | - throw new \Exception('compress and uncompress commands are required'); |
|
| 54 | + if (self::$installed === false) { |
|
| 55 | + throw new \Exception('compress and uncompress commands are required'); |
|
| 56 | + } |
|
| 55 | 57 | |
| 56 | 58 | $schema = 'compress.lzw://'; |
| 57 | - if (strncasecmp($schema, $path, strlen($schema)) == 0) |
|
| 58 | - $path = substr($path, strlen($schema)); |
|
| 59 | + if (strncasecmp($schema, $path, strlen($schema)) == 0) { |
|
| 60 | + $path = substr($path, strlen($schema)); |
|
| 61 | + } |
|
| 59 | 62 | |
| 60 | 63 | if (file_exists($path)) { |
| 61 | 64 | $this->path = realpath($path); |
@@ -69,14 +72,16 @@ discard block |
||
| 69 | 72 | $this->read(); |
| 70 | 73 | } else { |
| 71 | 74 | $prefix = basename(__FILE__, '.php'); |
| 72 | - if (($tmp = tempnam(sys_get_temp_dir(), $prefix)) === false) |
|
| 73 | - throw new \Exception(__CLASS__.', line '.__LINE__. |
|
| 75 | + if (($tmp = tempnam(sys_get_temp_dir(), $prefix)) === false) { |
|
| 76 | + throw new \Exception(__CLASS__.', line '.__LINE__. |
|
| 74 | 77 | ': Could not create temporary file in '. |
| 75 | 78 | sys_get_temp_dir()); |
| 76 | - if (($tmp2 = tempnam(sys_get_temp_dir(), $prefix)) === false) |
|
| 77 | - throw new \Exception(__CLASS__.', line '.__LINE__. |
|
| 79 | + } |
|
| 80 | + if (($tmp2 = tempnam(sys_get_temp_dir(), $prefix)) === false) { |
|
| 81 | + throw new \Exception(__CLASS__.', line '.__LINE__. |
|
| 78 | 82 | ': Could not create temporary file in '. |
| 79 | 83 | sys_get_temp_dir()); |
| 84 | + } |
|
| 80 | 85 | $this->tmp = $tmp; |
| 81 | 86 | $this->tmp2 = $tmp2; |
| 82 | 87 | $this->read(); |
@@ -85,14 +90,16 @@ discard block |
||
| 85 | 90 | $this->path = $path; |
| 86 | 91 | if (self::$forceTmpFile) { |
| 87 | 92 | $prefix = basename(__FILE__, '.php'); |
| 88 | - if (($tmp = tempnam(sys_get_temp_dir(), $prefix)) === false) |
|
| 89 | - throw new \Exception(__CLASS__.', line '.__LINE__. |
|
| 93 | + if (($tmp = tempnam(sys_get_temp_dir(), $prefix)) === false) { |
|
| 94 | + throw new \Exception(__CLASS__.', line '.__LINE__. |
|
| 90 | 95 | ': Could not create temporary file in '. |
| 91 | 96 | sys_get_temp_dir()); |
| 92 | - if (($tmp2 = tempnam(sys_get_temp_dir(), $prefix)) === false) |
|
| 93 | - throw new \Exception(__CLASS__.', line '.__LINE__. |
|
| 97 | + } |
|
| 98 | + if (($tmp2 = tempnam(sys_get_temp_dir(), $prefix)) === false) { |
|
| 99 | + throw new \Exception(__CLASS__.', line '.__LINE__. |
|
| 94 | 100 | ': Could not create temporary file in '. |
| 95 | 101 | sys_get_temp_dir()); |
| 102 | + } |
|
| 96 | 103 | $this->tmp = $tmp; |
| 97 | 104 | $this->tmp2 = $tmp2; |
| 98 | 105 | $this->pointer = 0; |
@@ -271,7 +278,9 @@ discard block |
||
| 271 | 278 | } |
| 272 | 279 | if ($this->tmp !== null) { |
| 273 | 280 | unlink($this->tmp); |
| 274 | - if (file_exists($this->tmp2)) unlink($this->tmp2); |
|
| 281 | + if (file_exists($this->tmp2)) { |
|
| 282 | + unlink($this->tmp2); |
|
| 283 | + } |
|
| 275 | 284 | } else { |
| 276 | 285 | $this->data = null; |
| 277 | 286 | $this->dataSize = 0; |