Passed
Push — 0.1.x ( dc924c...e5de81 )
by f
01:32
created
src/LzwStreamWrapper.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
     private static $AVERAGE_COMPRESSION_RATIO = 2;
18 18
     public static $forceTmpFile = false;
19 19
     /** High limit. unit: MBytes.
20
-    */
20
+     */
21 21
     public static $highLimit = 512;
22 22
 
23 23
     private $mode;
Please login to merge, or discard this patch.
Braces   +29 added lines, -19 removed lines patch added patch discarded remove patch
@@ -8,8 +8,9 @@  discard block
 block discarded – undo
8 8
 
9 9
     public static function registerWrapper()
10 10
     {
11
-        if (!self::$registered)
12
-            stream_wrapper_register('compress.lzw', __CLASS__);
11
+        if (!self::$registered) {
12
+                    stream_wrapper_register('compress.lzw', __CLASS__);
13
+        }
13 14
         self::$registered = true;
14 15
     }
15 16
 
@@ -40,12 +41,14 @@  discard block
 block discarded – undo
40 41
     {
41 42
         // check for compress & uncompress utility
42 43
         $this->checkBinary();
43
-        if (self::$installed === false)
44
-            throw new \Exception('compress and uncompress commands are required');
44
+        if (self::$installed === false) {
45
+                    throw new \Exception('compress and uncompress commands are required');
46
+        }
45 47
 
46 48
         $schema = 'compress.lzw://';
47
-        if (strncasecmp($schema, $path, strlen($schema)) == 0)
48
-            $path = substr($path, strlen($schema));
49
+        if (strncasecmp($schema, $path, strlen($schema)) == 0) {
50
+                    $path = substr($path, strlen($schema));
51
+        }
49 52
 
50 53
         if (file_exists($path)) {
51 54
             $this->path = realpath($path);
@@ -59,14 +62,16 @@  discard block
 block discarded – undo
59 62
                 $this->read();
60 63
             } else {
61 64
                 $prefix = basename(__FILE__, '.php');
62
-                if (($tmp = tempnam(sys_get_temp_dir(), $prefix)) === false)
63
-                    throw new \Exception(__CLASS__.', line '.__LINE__.
65
+                if (($tmp = tempnam(sys_get_temp_dir(), $prefix)) === false) {
66
+                                    throw new \Exception(__CLASS__.', line '.__LINE__.
64 67
                         ': Could not create temporary file in '.
65 68
                         sys_get_temp_dir());
66
-                if (($tmp2 = tempnam(sys_get_temp_dir(), $prefix)) === false)
67
-                    throw new \Exception(__CLASS__.', line '.__LINE__.
69
+                }
70
+                if (($tmp2 = tempnam(sys_get_temp_dir(), $prefix)) === false) {
71
+                                    throw new \Exception(__CLASS__.', line '.__LINE__.
68 72
                         ': Could not create temporary file in '.
69 73
                         sys_get_temp_dir());
74
+                }
70 75
                 $this->tmp = $tmp;
71 76
                 $this->tmp2 = $tmp2;
72 77
                 $this->read();
@@ -75,14 +80,16 @@  discard block
 block discarded – undo
75 80
             $this->path = $path;
76 81
             if (self::$forceTmpFile) {
77 82
                 $prefix = basename(__FILE__, '.php');
78
-                if (($tmp = tempnam(sys_get_temp_dir(), $prefix)) === false)
79
-                    throw new \Exception(__CLASS__.', line '.__LINE__.
83
+                if (($tmp = tempnam(sys_get_temp_dir(), $prefix)) === false) {
84
+                                    throw new \Exception(__CLASS__.', line '.__LINE__.
80 85
                         ': Could not create temporary file in '.
81 86
                         sys_get_temp_dir());
82
-                if (($tmp2 = tempnam(sys_get_temp_dir(), $prefix)) === false)
83
-                    throw new \Exception(__CLASS__.', line '.__LINE__.
87
+                }
88
+                if (($tmp2 = tempnam(sys_get_temp_dir(), $prefix)) === false) {
89
+                                    throw new \Exception(__CLASS__.', line '.__LINE__.
84 90
                         ': Could not create temporary file in '.
85 91
                         sys_get_temp_dir());
92
+                }
86 93
                 $this->tmp = $tmp;
87 94
                 $this->tmp2 = $tmp2;
88 95
                 $this->pointer = 0;
@@ -263,7 +270,9 @@  discard block
 block discarded – undo
263 270
         }
264 271
         if ($this->tmp !== null) {
265 272
             unlink($this->tmp);
266
-            if (file_exists($this->tmp2)) unlink($this->tmp2);
273
+            if (file_exists($this->tmp2)) {
274
+             unlink($this->tmp2);
275
+            }
267 276
         } else {
268 277
             $this->data = null;
269 278
         }
@@ -407,10 +416,11 @@  discard block
 block discarded – undo
407 416
                 self::$installed = false;
408 417
             } else {
409 418
                 self::exec('command -v uncompress', $output);
410
-                if (empty($output))
411
-                    self::$installed = false;
412
-                else
413
-                    self::$installed = true;
419
+                if (empty($output)) {
420
+                                    self::$installed = false;
421
+                } else {
422
+                                    self::$installed = true;
423
+                }
414 424
             }
415 425
         }
416 426
     }
Please login to merge, or discard this patch.
src/CamApplication.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 
60 60
         if (!empty($not_installed)) {
61 61
             echo 'Not supported archive types:'.PHP_EOL;
62
-            array_walk($not_installed, function ($instruction, $extension) {
62
+            array_walk($not_installed, function($instruction, $extension) {
63 63
                 echo '- '.$extension.': '.$instruction.PHP_EOL;
64 64
             });
65 65
         }
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
             if ($archived_files === false)
290 290
                 echo 'Error'.PHP_EOL;
291 291
             else
292
-                echo 'Created archive ' . $args['ARCHIVE'] . ' with ' . $archived_files . ' file(s) of total size ' . implode('', $this->formatSize(filesize($args['ARCHIVE']))) . PHP_EOL;
292
+                echo 'Created archive '.$args['ARCHIVE'].' with '.$archived_files.' file(s) of total size '.implode('', $this->formatSize(filesize($args['ARCHIVE']))).PHP_EOL;
293 293
         }
294 294
     }
295 295
 }
Please login to merge, or discard this patch.
Braces   +51 added lines, -34 removed lines patch added patch discarded remove patch
@@ -12,12 +12,14 @@  discard block
 block discarded – undo
12 12
      */
13 13
     protected function open($file)
14 14
     {
15
-        if (!UnifiedArchive::canOpenArchive($file))
16
-            throw new Exception('Could not open archive '.$file.'. Try installing suggested packages or run `cam -f` to see formats support.');
15
+        if (!UnifiedArchive::canOpenArchive($file)) {
16
+                    throw new Exception('Could not open archive '.$file.'. Try installing suggested packages or run `cam -f` to see formats support.');
17
+        }
17 18
 
18 19
         $archive = UnifiedArchive::open($file);
19
-        if ($archive === null)
20
-            throw new Exception('Could not open archive '.$file);
20
+        if ($archive === null) {
21
+                    throw new Exception('Could not open archive '.$file);
22
+        }
21 23
 
22 24
         return $archive;
23 25
     }
@@ -135,17 +137,18 @@  discard block
 block discarded – undo
135 137
      */
136 138
     public function formatDate($unixtime)
137 139
     {
138
-        if (strtotime('today') < $unixtime)
139
-            return 'Today, '.date('G:m', $unixtime);
140
-        else if (strtotime('yesterday') < $unixtime)
141
-            return 'Yesterday, '.date('G:m', $unixtime);
142
-        else {
140
+        if (strtotime('today') < $unixtime) {
141
+                    return 'Today, '.date('G:m', $unixtime);
142
+        } else if (strtotime('yesterday') < $unixtime) {
143
+                    return 'Yesterday, '.date('G:m', $unixtime);
144
+        } else {
143 145
             $datetime = new \DateTime();
144 146
             $datetime->setTimestamp($unixtime);
145
-            if ($datetime->format('Y') == date('Y'))
146
-                return $datetime->format('d M, G:m');
147
-            else
148
-                return $datetime->format('d M Y, G:m');
147
+            if ($datetime->format('Y') == date('Y')) {
148
+                            return $datetime->format('d M, G:m');
149
+            } else {
150
+                            return $datetime->format('d M Y, G:m');
151
+            }
149 152
         }
150 153
     }
151 154
 
@@ -175,25 +178,36 @@  discard block
 block discarded – undo
175 178
         $archive = $this->open($args['ARCHIVE']);
176 179
         $output = getcwd();
177 180
         if (isset($args['--output'])) {
178
-            if (!is_dir($args['--output']))
179
-                mkdir($args['--output']);
181
+            if (!is_dir($args['--output'])) {
182
+                            mkdir($args['--output']);
183
+            }
180 184
             $output = realpath($args['--output']);
181 185
         }
182 186
 
183 187
         if (empty($args['FILES_IN_ARCHIVE']) || $args['FILES_IN_ARCHIVE'] == array('/') || $args['FILES_IN_ARCHIVE'] == array('*')) {
184 188
             $result = $archive->extractFiles($output);
185
-            if ($result === false) echo 'Error occured'.PHP_EOL;
186
-            else echo 'Extracted '.$result.' file(s) to '.$output.PHP_EOL;
189
+            if ($result === false) {
190
+             echo 'Error occured'.PHP_EOL;
191
+            } else {
192
+             echo 'Extracted '.$result.' file(s) to '.$output.PHP_EOL;
193
+            }
187 194
         } else {
188 195
             $extracted = 0;
189 196
             $errored = [];
190 197
             foreach ($args['FILES_IN_ARCHIVE'] as $file) {
191 198
                 $result = $archive->extractFiles($output, $file);
192
-                if ($result === false) $errored[] = $file;
193
-                else $extracted += $result;
199
+                if ($result === false) {
200
+                 $errored[] = $file;
201
+                } else {
202
+                 $extracted += $result;
203
+                }
204
+            }
205
+            if (!empty($errored)) {
206
+             echo 'Errored: '.implode(', ', $errored).PHP_EOL;
207
+            }
208
+            if ($extracted > 0) {
209
+             echo 'Exctracted '.$extracted.' file(s) to '.$output.PHP_EOL;
194 210
             }
195
-            if (!empty($errored)) echo 'Errored: '.implode(', ', $errored).PHP_EOL;
196
-            if ($extracted > 0) echo 'Exctracted '.$extracted.' file(s) to '.$output.PHP_EOL;
197 211
         }
198 212
     }
199 213
 
@@ -252,8 +266,9 @@  discard block
 block discarded – undo
252 266
                 echo 'File '.$file.' is NOT in archive'.PHP_EOL;
253 267
                 continue;
254 268
             }
255
-            if ($archive->deleteFiles($file) === false)
256
-                echo 'Error file '.$file.PHP_EOL;
269
+            if ($archive->deleteFiles($file) === false) {
270
+                            echo 'Error file '.$file.PHP_EOL;
271
+            }
257 272
         }
258 273
     }
259 274
 
@@ -266,10 +281,11 @@  discard block
 block discarded – undo
266 281
     {
267 282
         $archive = $this->open($args['ARCHIVE']);
268 283
         $added_files = $archive->addFiles($args['FILES_ON_DISK']);
269
-        if ($added_files === false)
270
-            echo 'Error'.PHP_EOL;
271
-        else
272
-            echo 'Added '.$added_files.' file(s)'.PHP_EOL;
284
+        if ($added_files === false) {
285
+                    echo 'Error'.PHP_EOL;
286
+        } else {
287
+                    echo 'Added '.$added_files.' file(s)'.PHP_EOL;
288
+        }
273 289
     }
274 290
 
275 291
     /**
@@ -279,17 +295,18 @@  discard block
 block discarded – undo
279 295
     public function create($args)
280 296
     {
281 297
         if (file_exists($args['ARCHIVE'])) {
282
-            if (is_dir($args['ARCHIVE']))
283
-                echo $args['ARCHIVE'].' is a directory!'.PHP_EOL;
284
-            else {
298
+            if (is_dir($args['ARCHIVE'])) {
299
+                            echo $args['ARCHIVE'].' is a directory!'.PHP_EOL;
300
+            } else {
285 301
                 echo 'File '.$args['ARCHIVE'].' already exists!'.PHP_EOL;
286 302
             }
287 303
         } else {
288 304
             $archived_files = UnifiedArchive::archiveFiles($args['FILES_ON_DISK'], $args['ARCHIVE']);
289
-            if ($archived_files === false)
290
-                echo 'Error'.PHP_EOL;
291
-            else
292
-                echo 'Created archive ' . $args['ARCHIVE'] . ' with ' . $archived_files . ' file(s) of total size ' . implode('', $this->formatSize(filesize($args['ARCHIVE']))) . PHP_EOL;
305
+            if ($archived_files === false) {
306
+                            echo 'Error'.PHP_EOL;
307
+            } else {
308
+                            echo 'Created archive ' . $args['ARCHIVE'] . ' with ' . $archived_files . ' file(s) of total size ' . implode('', $this->formatSize(filesize($args['ARCHIVE']))) . PHP_EOL;
309
+            }
293 310
         }
294 311
     }
295 312
 }
Please login to merge, or discard this patch.
src/ArchiveEntry.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -63,8 +63,9 @@
 block discarded – undo
63 63
         $this->compressed_size = $this->compressedSize = $compressedSize;
64 64
         $this->uncompressed_size = $this->uncompressedSize = $uncompressedSize;
65 65
         $this->mtime = $this->modificationTime = $modificationTime;
66
-        if ($isCompressed === null)
67
-            $isCompressed = $uncompressedSize !== $compressedSize;
66
+        if ($isCompressed === null) {
67
+                    $isCompressed = $uncompressedSize !== $compressedSize;
68
+        }
68 69
         $this->is_compressed = $this->isCompressed = $isCompressed;
69 70
     }
70 71
 }
71 72
\ No newline at end of file
Please login to merge, or discard this patch.
src/Formats/Zip.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -205,7 +205,7 @@
 block discarded – undo
205 205
      * @return false|int
206 206
      * @throws \Exception
207 207
      */
208
-    public static function createArchive(array $files, $archiveFileName){
208
+    public static function createArchive(array $files, $archiveFileName) {
209 209
         $zip = new ZipArchive();
210 210
         $result = $zip->open($archiveFileName, ZipArchive::CREATE);
211 211
         if ($result !== true)
Please login to merge, or discard this patch.
Braces   +30 added lines, -20 removed lines patch added patch discarded remove patch
@@ -71,8 +71,9 @@  discard block
 block discarded – undo
71 71
     public function getFileNames()
72 72
     {
73 73
         $files = [];
74
-        for ($i = 0; $i < $this->zip->numFiles; $i++)
75
-            $files[] = $this->zip->getNameIndex($i);
74
+        for ($i = 0; $i < $this->zip->numFiles; $i++) {
75
+                    $files[] = $this->zip->getNameIndex($i);
76
+        }
76 77
         return $files;
77 78
     }
78 79
 
@@ -107,8 +108,9 @@  discard block
 block discarded – undo
107 108
     public function getFileContent($fileName)
108 109
     {
109 110
         $result = $this->zip->getFromName($fileName);
110
-        if ($result === false)
111
-            throw new Exception('Could not get file information: '.$result);
111
+        if ($result === false) {
112
+                    throw new Exception('Could not get file information: '.$result);
113
+        }
112 114
         return $result;
113 115
     }
114 116
 
@@ -130,8 +132,9 @@  discard block
 block discarded – undo
130 132
      */
131 133
     public function extractFiles($outputFolder, array $files)
132 134
     {
133
-        if ($this->zip->extractTo($outputFolder, $files) === false)
134
-            throw new Exception($this->zip->getStatusString(), $this->zip->status);
135
+        if ($this->zip->extractTo($outputFolder, $files) === false) {
136
+                    throw new Exception($this->zip->getStatusString(), $this->zip->status);
137
+        }
135 138
 
136 139
         return count($files);
137 140
     }
@@ -142,8 +145,9 @@  discard block
 block discarded – undo
142 145
      */
143 146
     public function extractArchive($outputFolder)
144 147
     {
145
-        if ($this->zip->extractTo($outputFolder) === false)
146
-            throw new Exception($this->zip->getStatusString(), $this->zip->status);
148
+        if ($this->zip->extractTo($outputFolder) === false) {
149
+                    throw new Exception($this->zip->getStatusString(), $this->zip->status);
150
+        }
147 151
         return $this->zip->numFiles;
148 152
     }
149 153
 
@@ -157,8 +161,9 @@  discard block
 block discarded – undo
157 161
     {
158 162
         $count = 0;
159 163
         foreach ($files as $file) {
160
-            if ($this->zip->deleteName($file) === false)
161
-                throw new Exception($this->zip->getStatusString(), $this->zip->status);
164
+            if ($this->zip->deleteName($file) === false) {
165
+                            throw new Exception($this->zip->getStatusString(), $this->zip->status);
166
+            }
162 167
             $count++;
163 168
         }
164 169
 
@@ -181,11 +186,13 @@  discard block
 block discarded – undo
181 186
         $added_files = 0;
182 187
         foreach ($files as $localName => $fileName) {
183 188
             if (is_null($fileName)) {
184
-                if ($this->zip->addEmptyDir($localName) === false)
185
-                    throw new Exception($this->zip->getStatusString(), $this->zip->status);
189
+                if ($this->zip->addEmptyDir($localName) === false) {
190
+                                    throw new Exception($this->zip->getStatusString(), $this->zip->status);
191
+                }
186 192
             } else {
187
-                if ($this->zip->addFile($fileName, $localName) === false)
188
-                    throw new Exception($this->zip->getStatusString(), $this->zip->status);
193
+                if ($this->zip->addFile($fileName, $localName) === false) {
194
+                                    throw new Exception($this->zip->getStatusString(), $this->zip->status);
195
+                }
189 196
                 $added_files++;
190 197
             }
191 198
         }
@@ -208,15 +215,18 @@  discard block
 block discarded – undo
208 215
     public static function createArchive(array $files, $archiveFileName){
209 216
         $zip = new ZipArchive();
210 217
         $result = $zip->open($archiveFileName, ZipArchive::CREATE);
211
-        if ($result !== true)
212
-            throw new Exception('ZipArchive error: '.$result);
218
+        if ($result !== true) {
219
+                    throw new Exception('ZipArchive error: '.$result);
220
+        }
213 221
         foreach ($files as $localName => $fileName) {
214 222
             if ($fileName === null) {
215
-                if ($zip->addEmptyDir($localName) === false)
216
-                    return false;
223
+                if ($zip->addEmptyDir($localName) === false) {
224
+                                    return false;
225
+                }
217 226
             } else {
218
-                if ($zip->addFile($fileName, $localName) === false)
219
-                    return false;
227
+                if ($zip->addFile($fileName, $localName) === false) {
228
+                                    return false;
229
+                }
220 230
             }
221 231
         }
222 232
         $zip->close();
Please login to merge, or discard this patch.
src/Formats/OneFileFormat.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -129,7 +129,7 @@
 block discarded – undo
129 129
      * @return false|int
130 130
      * @throws \wapmorgan\UnifiedArchive\UnsupportedOperationException
131 131
      */
132
-    public static function createArchive(array $files, $archiveFileName){
132
+    public static function createArchive(array $files, $archiveFileName) {
133 133
         if (count($files) > 1) return false;
134 134
         $filename = array_shift($files);
135 135
         if (is_null($filename)) return false; // invalid list
Please login to merge, or discard this patch.
Braces   +19 added lines, -10 removed lines patch added patch discarded remove patch
@@ -25,8 +25,9 @@  discard block
 block discarded – undo
25 25
      */
26 26
     public function __construct($archiveFileName)
27 27
     {
28
-        if (static::FORMAT_SUFFIX === null)
29
-            throw new \Exception('Format should be initialized');
28
+        if (static::FORMAT_SUFFIX === null) {
29
+                    throw new \Exception('Format should be initialized');
30
+        }
30 31
         $this->fileName = $archiveFileName;
31 32
         $this->inArchiveFileName = basename($archiveFileName, '.'.self::FORMAT_SUFFIX);
32 33
     }
@@ -93,11 +94,13 @@  discard block
 block discarded – undo
93 94
     public function extractArchive($outputFolder)
94 95
     {
95 96
         $data = $this->getFileContent($this->inArchiveFileName);
96
-        if ($data === false)
97
-            throw new Exception('Could not extract archive');
97
+        if ($data === false) {
98
+                    throw new Exception('Could not extract archive');
99
+        }
98 100
 
99
-        if (file_put_contents($outputFolder.$this->inArchiveFileName, $data) !== false)
100
-            return 1;
101
+        if (file_put_contents($outputFolder.$this->inArchiveFileName, $data) !== false) {
102
+                    return 1;
103
+        }
101 104
     }
102 105
 
103 106
     /**
@@ -130,12 +133,18 @@  discard block
 block discarded – undo
130 133
      * @throws \wapmorgan\UnifiedArchive\UnsupportedOperationException
131 134
      */
132 135
     public static function createArchive(array $files, $archiveFileName){
133
-        if (count($files) > 1) return false;
136
+        if (count($files) > 1) {
137
+         return false;
138
+        }
134 139
         $filename = array_shift($files);
135
-        if (is_null($filename)) return false; // invalid list
140
+        if (is_null($filename)) {
141
+         return false;
142
+        }
143
+        // invalid list
136 144
         if (file_put_contents($archiveFileName,
137
-                static::compressData(file_get_contents($filename))) !== false)
138
-            return 1;
145
+                static::compressData(file_get_contents($filename))) !== false) {
146
+                    return 1;
147
+        }
139 148
     }
140 149
 
141 150
     /**
Please login to merge, or discard this patch.
src/Formats/SevenZip.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -35,8 +35,8 @@
 block discarded – undo
35 35
         $information = new ArchiveInformation();
36 36
         foreach ($this->sevenZip->getEntries() as $entry) {
37 37
             $information->files[] = $entry->getPath();
38
-            $information->compressedFilesSize += (int)$entry->getPackedSize();
39
-            $information->uncompressedFilesSize += (int)$entry->getSize();
38
+            $information->compressedFilesSize += (int) $entry->getPackedSize();
39
+            $information->uncompressedFilesSize += (int) $entry->getSize();
40 40
         }
41 41
         return $information;
42 42
     }
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -47,8 +47,9 @@
 block discarded – undo
47 47
     public function getFileNames()
48 48
     {
49 49
         $files = [];
50
-        foreach ($this->sevenZip->getEntries() as $entry)
51
-            $files[] = $entry->getPath();
50
+        foreach ($this->sevenZip->getEntries() as $entry) {
51
+                    $files[] = $entry->getPath();
52
+        }
52 53
         return $files;
53 54
     }
54 55
 
Please login to merge, or discard this patch.
src/Formats/Rar.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -167,7 +167,7 @@
 block discarded – undo
167 167
      * @param string $archiveFileName
168 168
      * @throws \wapmorgan\UnifiedArchive\UnsupportedOperationException
169 169
      */
170
-    public static function createArchive(array $files, $archiveFileName){
170
+    public static function createArchive(array $files, $archiveFileName) {
171 171
         throw new UnsupportedOperationException();
172 172
     }
173 173
 }
174 174
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -101,7 +101,9 @@  discard block
 block discarded – undo
101 101
     public function getFileContent($fileName)
102 102
     {
103 103
         $entry = $this->rar->getEntry($fileName);
104
-        if ($entry->isDirectory()) return false;
104
+        if ($entry->isDirectory()) {
105
+         return false;
106
+        }
105 107
         return stream_get_contents($entry->getStream());
106 108
     }
107 109
 
@@ -113,7 +115,9 @@  discard block
 block discarded – undo
113 115
     public function getFileResource($fileName)
114 116
     {
115 117
         $entry = $this->rar->getEntry($fileName);
116
-        if ($entry->isDirectory()) return false;
118
+        if ($entry->isDirectory()) {
119
+         return false;
120
+        }
117 121
         return $entry->getStream();
118 122
     }
119 123
 
Please login to merge, or discard this patch.
src/Formats/Lzma.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
  */
10 10
 class Lzma extends OneFileFormat
11 11
 {
12
-    const FORMAT_SUFFIX =  'xz';
12
+    const FORMAT_SUFFIX = 'xz';
13 13
 
14 14
     /**
15 15
      * Lzma constructor.
Please login to merge, or discard this patch.
src/Formats/Iso.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -74,14 +74,14 @@  discard block
 block discarded – undo
74 74
                     if (in_array($file->strd_FileId, ['.', '..']))
75 75
                         continue;
76 76
                     $this->files[$file->Location]
77
-                        = $directory . $file->strd_FileId;
77
+                        = $directory.$file->strd_FileId;
78 78
                     $this->filesSize += $file->DataLen;
79 79
 
80
-                    $this->filesData[$directory . $file->strd_FileId] =
80
+                    $this->filesData[$directory.$file->strd_FileId] =
81 81
                         [
82 82
                             'size' => $file->DataLen,
83 83
                             'mtime' =>
84
-                                strtotime((string)$file->isoRecDate),
84
+                                strtotime((string) $file->isoRecDate),
85 85
                         ];
86 86
                 }
87 87
             }
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
             return false;
130 130
 
131 131
         return new ArchiveEntry($fileName, $this->filesData[$fileName]['size'],
132
-            $this->filesData[$fileName]['size'], $this->filesData[$fileName]['mtime'],false);
132
+            $this->filesData[$fileName]['size'], $this->filesData[$fileName]['mtime'], false);
133 133
     }
134 134
 
135 135
     /**
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
      * @return false|int
222 222
      * @throws UnsupportedOperationException
223 223
      */
224
-    public static function createArchive(array $files, $archiveFileName){
224
+    public static function createArchive(array $files, $archiveFileName) {
225 225
         throw new UnsupportedOperationException();
226 226
     }
227 227
 }
228 228
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +21 added lines, -12 removed lines patch added patch discarded remove patch
@@ -52,8 +52,9 @@  discard block
 block discarded – undo
52 52
 
53 53
         $usedDesc =
54 54
             $this->iso->GetDescriptor(SUPPLEMENTARY_VOLUME_DESC);
55
-        if (!$usedDesc)
56
-            $usedDesc = $this->iso->GetDescriptor(PRIMARY_VOLUME_DESC);
55
+        if (!$usedDesc) {
56
+                    $usedDesc = $this->iso->GetDescriptor(PRIMARY_VOLUME_DESC);
57
+        }
57 58
         $this->blockSize = $usedDesc->iBlockSize;
58 59
 
59 60
         $directories = $usedDesc->LoadMPathTable($this->iso);
@@ -71,8 +72,9 @@  discard block
 block discarded – undo
71 72
                 $usedDesc->iBlockSize, true);
72 73
             if ($files) {
73 74
                 foreach ($files as $file) {
74
-                    if (in_array($file->strd_FileId, ['.', '..']))
75
-                        continue;
75
+                    if (in_array($file->strd_FileId, ['.', '..'])) {
76
+                                            continue;
77
+                    }
76 78
                     $this->files[$file->Location]
77 79
                         = $directory . $file->strd_FileId;
78 80
                     $this->filesSize += $file->DataLen;
@@ -125,8 +127,9 @@  discard block
 block discarded – undo
125 127
      */
126 128
     public function getFileData($fileName)
127 129
     {
128
-        if (!isset($this->filesData[$fileName]))
129
-            return false;
130
+        if (!isset($this->filesData[$fileName])) {
131
+                    return false;
132
+        }
130 133
 
131 134
         return new ArchiveEntry($fileName, $this->filesData[$fileName]['size'],
132 135
             $this->filesData[$fileName]['size'], $this->filesData[$fileName]['mtime'],false);
@@ -140,11 +143,14 @@  discard block
 block discarded – undo
140 143
     public function getFileContent($fileName)
141 144
     {
142 145
         $Location = array_search($fileName, $this->files, true);
143
-        if (!isset($this->filesData[$fileName])) return false;
146
+        if (!isset($this->filesData[$fileName])) {
147
+         return false;
148
+        }
144 149
         $data = $this->filesData[$fileName];
145 150
         $Location_Real = $Location * $this->blockSize;
146
-        if ($this->iso->Seek($Location_Real, SEEK_SET) === false)
147
-            return false;
151
+        if ($this->iso->Seek($Location_Real, SEEK_SET) === false) {
152
+                    return false;
153
+        }
148 154
 
149 155
         return $this->iso->Read($data['size']);
150 156
     }
@@ -157,11 +163,14 @@  discard block
 block discarded – undo
157 163
     public function getFileResource($fileName)
158 164
     {
159 165
         $Location = array_search($fileName, $this->files, true);
160
-        if (!isset($this->filesData[$fileName])) return false;
166
+        if (!isset($this->filesData[$fileName])) {
167
+         return false;
168
+        }
161 169
         $data = $this->filesData[$fileName];
162 170
         $Location_Real = $Location * $this->blockSize;
163
-        if ($this->iso->Seek($Location_Real, SEEK_SET) === false)
164
-            return false;
171
+        if ($this->iso->Seek($Location_Real, SEEK_SET) === false) {
172
+                    return false;
173
+        }
165 174
 
166 175
         $resource = fopen('php://temp', 'r+');
167 176
         fwrite($resource, $this->iso->Read($data['size']));
Please login to merge, or discard this patch.