Passed
Push — master ( a7d2a0...df2343 )
by f
29:27 queued 14:29
created
src/Commands/FormatCommand.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
             $question = new ChoiceQuestion('Which format', array_keys($formats));
42 42
             $format = $helper->ask($input, $output, $question);
43 43
         }
44
-        $output->writeln('Format <info>' . $format . '</info> drivers support');
44
+        $output->writeln('Format <info>'.$format.'</info> drivers support');
45 45
 
46 46
         $table = new Table($output);
47 47
         $table->setHeaders(['format', ...array_keys(self::$abilitiesLabels)]);
Please login to merge, or discard this patch.
src/Drivers/AlchemyZippy.php 2 patches
Braces   +11 added lines, -8 removed lines patch added patch discarded remove patch
@@ -61,10 +61,11 @@  discard block
 block discarded – undo
61 61
 
62 62
     protected static function init()
63 63
     {
64
-        if (!class_exists('\Alchemy\Zippy\Zippy'))
65
-            static::$zippy = false;
66
-        else if (static::$zippy === null)
67
-            static::$zippy = Zippy::load();
64
+        if (!class_exists('\Alchemy\Zippy\Zippy')) {
65
+                    static::$zippy = false;
66
+        } else if (static::$zippy === null) {
67
+                    static::$zippy = Zippy::load();
68
+        }
68 69
     }
69 70
 
70 71
     /**
@@ -75,8 +76,9 @@  discard block
 block discarded – undo
75 76
     {
76 77
         static::init();
77 78
 
78
-        if (static::$zippy === false)
79
-            return [];
79
+        if (static::$zippy === false) {
80
+                    return [];
81
+        }
80 82
 
81 83
         switch ($format) {
82 84
             case Formats::TAR_BZIP:
@@ -212,8 +214,9 @@  discard block
 block discarded – undo
212 214
         $information = new ArchiveInformation();
213 215
 
214 216
         foreach ($this->archive->getMembers() as $member) {
215
-            if ($member->isDir())
216
-                continue;
217
+            if ($member->isDir()) {
218
+                            continue;
219
+            }
217 220
 
218 221
             $this->files[] = $information->files[] = str_replace('\\', '/', $member->getLocation());
219 222
             $this->members[str_replace('\\', '/', $member->getLocation())] = $member;
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -63,9 +63,9 @@  discard block
 block discarded – undo
63 63
     public static function getInstallationInstruction()
64 64
     {
65 65
         self::init();
66
-        return 'install library [alchemy/zippy]: `composer require alchemy/zippy`' . "\n"  . ' and console programs (tar, zip): `apt install tar zip` - depends on OS'
67
-            . "\n" . 'If you install SevenZip and AlchemyZippy:' . "\n" .
68
-            '1. You should specify symfony/console version before installation to any **3.x.x version**:' . "\n" . '`composer require symfony/process:~3.4`, because they require different `symfony/process` versions.' . "\n" .
66
+        return 'install library [alchemy/zippy]: `composer require alchemy/zippy`'."\n".' and console programs (tar, zip): `apt install tar zip` - depends on OS'
67
+            . "\n".'If you install SevenZip and AlchemyZippy:'."\n".
68
+            '1. You should specify symfony/console version before installation to any **3.x.x version**:'."\n".'`composer require symfony/process:~3.4`, because they require different `symfony/process` versions.'."\n".
69 69
             '2. Install archive7z version 4.0.0: `composer require gemorroj/archive7z:~4.0`';
70 70
     }
71 71
 
@@ -190,8 +190,8 @@  discard block
 block discarded – undo
190 190
 
191 191
             $this->files[] = $information->files[] = str_replace('\\', '/', $member->getLocation());
192 192
             $this->members[str_replace('\\', '/', $member->getLocation())] = $member;
193
-            $information->compressedFilesSize += (int)$member->getSize();
194
-            $information->uncompressedFilesSize += (int)$member->getSize();
193
+            $information->compressedFilesSize += (int) $member->getSize();
194
+            $information->uncompressedFilesSize += (int) $member->getSize();
195 195
         }
196 196
         return $information;
197 197
     }
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
     public function getFileContent($fileName)
241 241
     {
242 242
         $member = $this->getMember($fileName);
243
-        return (string)$member;
243
+        return (string) $member;
244 244
     }
245 245
 
246 246
     /**
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
     public function getFileStream($fileName)
250 250
     {
251 251
         $member = $this->getMember($fileName);
252
-        return self::wrapStringInStream((string)$member);
252
+        return self::wrapStringInStream((string) $member);
253 253
     }
254 254
 
255 255
     /**
Please login to merge, or discard this patch.
src/UnifiedArchive.php 2 patches
Braces   +44 added lines, -31 removed lines patch added patch discarded remove patch
@@ -257,13 +257,15 @@  discard block
 block discarded – undo
257 257
      */
258 258
     public function getFileNames($filter = null)
259 259
     {
260
-        if ($filter === null)
261
-            return $this->files;
260
+        if ($filter === null) {
261
+                    return $this->files;
262
+        }
262 263
 
263 264
         $result = [];
264 265
         foreach ($this->files as $file) {
265
-            if (fnmatch($filter, $file))
266
-                $result[] = $file;
266
+            if (fnmatch($filter, $file)) {
267
+                            $result[] = $file;
268
+            }
267 269
         }
268 270
         return $result;
269 271
     }
@@ -390,8 +392,9 @@  discard block
 block discarded – undo
390 392
     {
391 393
         $files_list = static::createFilesList($fileOrFiles);
392 394
 
393
-        if (empty($files_list))
394
-            throw new EmptyFileListException('Files list is empty!');
395
+        if (empty($files_list)) {
396
+                    throw new EmptyFileListException('Files list is empty!');
397
+        }
395 398
 
396 399
         $result = $this->archive->addFiles($files_list);
397 400
         $this->scanArchive();
@@ -410,8 +413,9 @@  discard block
 block discarded – undo
410 413
      */
411 414
     public function addFile($file, $inArchiveName = null)
412 415
     {
413
-        if (!is_file($file))
414
-            throw new InvalidArgumentException($file.' is not a valid file to add in archive');
416
+        if (!is_file($file)) {
417
+                    throw new InvalidArgumentException($file.' is not a valid file to add in archive');
418
+        }
415 419
 
416 420
         return ($inArchiveName !== null
417 421
                 ? $this->addFiles([$inArchiveName => $file])
@@ -444,8 +448,9 @@  discard block
 block discarded – undo
444 448
      */
445 449
     public function addDirectory($directory, $inArchivePath = null)
446 450
     {
447
-        if (!is_dir($directory) || !is_readable($directory))
448
-            throw new InvalidArgumentException($directory.' is not a valid directory to add in archive');
451
+        if (!is_dir($directory) || !is_readable($directory)) {
452
+                    throw new InvalidArgumentException($directory.' is not a valid directory to add in archive');
453
+        }
449 454
 
450 455
         return ($inArchivePath !== null
451 456
                 ? $this->addFiles([$inArchivePath => $directory])
@@ -494,13 +499,15 @@  discard block
 block discarded – undo
494 499
     {
495 500
         $archiveType = Formats::detectArchiveFormat($archiveName, false);
496 501
 
497
-        if ($archiveType === false)
498
-            throw new UnsupportedArchiveException('Could not detect archive type for name "'.$archiveName.'"');
502
+        if ($archiveType === false) {
503
+                    throw new UnsupportedArchiveException('Could not detect archive type for name "'.$archiveName.'"');
504
+        }
499 505
 
500 506
         $files_list = static::createFilesList($fileOrFiles);
501 507
 
502
-        if (empty($files_list))
503
-            throw new EmptyFileListException('Files list is empty!');
508
+        if (empty($files_list)) {
509
+                    throw new EmptyFileListException('Files list is empty!');
510
+        }
504 511
 
505 512
         $totalSize = 0;
506 513
         foreach ($files_list as $fn) {
@@ -554,18 +561,21 @@  discard block
 block discarded – undo
554 561
         $fileProgressCallable = null
555 562
  )
556 563
     {
557
-        if (file_exists($archiveName))
558
-            throw new FileAlreadyExistsException('Archive '.$archiveName.' already exists!');
564
+        if (file_exists($archiveName)) {
565
+                    throw new FileAlreadyExistsException('Archive '.$archiveName.' already exists!');
566
+        }
559 567
 
560 568
         $info = static::prepareForArchiving($fileOrFiles, $archiveName);
561 569
 
562 570
         $abilities = [BasicDriver::CREATE];
563 571
 
564
-        if (!Formats::canCreate($info['type']))
565
-            throw new UnsupportedArchiveException('Unsupported archive type: '.$info['type'].' of archive '.$archiveName);
572
+        if (!Formats::canCreate($info['type'])) {
573
+                    throw new UnsupportedArchiveException('Unsupported archive type: '.$info['type'].' of archive '.$archiveName);
574
+        }
566 575
 
567
-        if ($password !== null && !Formats::canEncrypt($info['type']))
568
-            throw new UnsupportedOperationException('Archive type '.$info['type'].' can not be encrypted');
576
+        if ($password !== null && !Formats::canEncrypt($info['type'])) {
577
+                    throw new UnsupportedOperationException('Archive type '.$info['type'].' can not be encrypted');
578
+        }
569 579
         if ($password !== null) {
570 580
             $abilities[] = BasicDriver::CREATE_ENCRYPTED;
571 581
         }
@@ -619,8 +629,9 @@  discard block
 block discarded – undo
619 629
      */
620 630
     public static function archiveDirectory($directory, $archiveName, $compressionLevel = BasicDriver::COMPRESSION_AVERAGE, $password = null)
621 631
     {
622
-        if (!is_dir($directory) || !is_readable($directory))
623
-            throw new InvalidArgumentException($directory.' is not a valid directory to archive');
632
+        if (!is_dir($directory) || !is_readable($directory)) {
633
+                    throw new InvalidArgumentException($directory.' is not a valid directory to archive');
634
+        }
624 635
 
625 636
         return static::archiveFiles($directory, $archiveName, $compressionLevel, $password) > 0;
626 637
     }
@@ -656,9 +667,9 @@  discard block
 block discarded – undo
656 667
         if (is_array($nodes)) {
657 668
             foreach ($nodes as $destination => $source) {
658 669
                 // new format
659
-                if (is_numeric($destination))
660
-                    $destination = $source;
661
-                else {
670
+                if (is_numeric($destination)) {
671
+                                    $destination = $source;
672
+                } else {
662 673
                     // old format
663 674
                     if (is_string($source) && !file_exists($source)) {
664 675
                         list($destination, $source) = [$source, $destination];
@@ -692,11 +703,12 @@  discard block
 block discarded – undo
692 703
 
693 704
         } else if (is_string($nodes)) { // passed one file or directory
694 705
             // if is directory
695
-            if (is_dir($nodes))
696
-                static::importFilesFromDir(rtrim($nodes, '/\\*').'/*', null, true,
706
+            if (is_dir($nodes)) {
707
+                            static::importFilesFromDir(rtrim($nodes, '/\\*').'/*', null, true,
697 708
                     $files);
698
-            else if (is_file($nodes))
699
-                $files[basename($nodes)] = $nodes;
709
+            } else if (is_file($nodes)) {
710
+                            $files[basename($nodes)] = $nodes;
711
+            }
700 712
         }
701 713
 
702 714
         return $files;
@@ -713,8 +725,9 @@  discard block
 block discarded – undo
713 725
         // $map[$destination] = rtrim($source, '/*');
714 726
         // do not map root archive folder
715 727
 
716
-        if ($destination !== null)
717
-            $map[$destination] = null;
728
+        if ($destination !== null) {
729
+                    $map[$destination] = null;
730
+        }
718 731
 
719 732
         foreach (glob($source, GLOB_MARK) as $node) {
720 733
             if (in_array(substr($node, -1), ['/', '\\'], true) && $recursive) {
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -66,12 +66,12 @@  discard block
 block discarded – undo
66 66
     public static function open($fileName, $abilities = [], $password = null)
67 67
     {
68 68
         if (!file_exists($fileName) || !is_readable($fileName)) {
69
-            throw new InvalidArgumentException('Could not open file: ' . $fileName.' is not readable');
69
+            throw new InvalidArgumentException('Could not open file: '.$fileName.' is not readable');
70 70
         }
71 71
 
72 72
         $format = Formats::detectArchiveFormat($fileName);
73 73
         if ($format === false) {
74
-            throw new UnsupportedArchiveException('Can not recognize archive format for ' . $fileName);
74
+            throw new UnsupportedArchiveException('Can not recognize archive format for '.$fileName);
75 75
         }
76 76
 
77 77
         if (!empty($abilities) && is_string($abilities)) {
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
         }
88 88
         $driver = Formats::getFormatDriver($format, $abilities);
89 89
         if ($driver === null) {
90
-            throw new UnsupportedOperationException('Driver for ' . $format . ' (' . $fileName . ') is not found');
90
+            throw new UnsupportedOperationException('Driver for '.$format.' ('.$fileName.') is not found');
91 91
         }
92 92
 
93 93
         return new static($fileName, $format, $driver, $password);
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
     public function getFileData($fileName)
290 290
     {
291 291
         if (!in_array($fileName, $this->files, true)) {
292
-            throw new NonExistentArchiveFileException('File ' . $fileName . ' does not exist in archive');
292
+            throw new NonExistentArchiveFileException('File '.$fileName.' does not exist in archive');
293 293
         }
294 294
 
295 295
         return $this->archive->getFileData($fileName);
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
     public function getFileContent($fileName)
306 306
     {
307 307
         if (!in_array($fileName, $this->files, true)) {
308
-            throw new NonExistentArchiveFileException('File ' . $fileName . ' does not exist in archive');
308
+            throw new NonExistentArchiveFileException('File '.$fileName.' does not exist in archive');
309 309
         }
310 310
 
311 311
         return $this->archive->getFileContent($fileName);
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
     public function getFileStream($fileName)
322 322
     {
323 323
         if (!in_array($fileName, $this->files, true)) {
324
-            throw new NonExistentArchiveFileException('File ' . $fileName . ' does not exist in archive');
324
+            throw new NonExistentArchiveFileException('File '.$fileName.' does not exist in archive');
325 325
         }
326 326
 
327 327
         return $this->archive->getFileStream($fileName);
@@ -584,7 +584,7 @@  discard block
 block discarded – undo
584 584
         /** @var BasicDriver $driver */
585 585
         $driver = Formats::getFormatDriver($info['type'], $abilities);
586 586
         if ($driver === null) {
587
-            throw new UnsupportedArchiveException('Unsupported archive type: ' . $info['type'] . ' of archive ');
587
+            throw new UnsupportedArchiveException('Unsupported archive type: '.$info['type'].' of archive ');
588 588
         }
589 589
 
590 590
         return $driver::createArchive(
@@ -611,7 +611,7 @@  discard block
 block discarded – undo
611 611
     public static function archiveFile($file, $archiveName, $compressionLevel = BasicDriver::COMPRESSION_AVERAGE, $password = null)
612 612
     {
613 613
         if (!is_file($file)) {
614
-            throw new InvalidArgumentException($file . ' is not a valid file to archive');
614
+            throw new InvalidArgumentException($file.' is not a valid file to archive');
615 615
         }
616 616
 
617 617
         return static::archiveFiles($file, $archiveName, $compressionLevel, $password) === 1;
@@ -682,8 +682,8 @@  discard block
 block discarded – undo
682 682
                 if (is_array($source)) {
683 683
                     foreach ($source as $sourceItem) {
684 684
                         static::importFilesFromDir(
685
-                            rtrim($sourceItem, '/\\*') . '/*',
686
-                            !empty($destination) ? $destination . '/' : null,
685
+                            rtrim($sourceItem, '/\\*').'/*',
686
+                            !empty($destination) ? $destination.'/' : null,
687 687
                             true,
688 688
                             $files
689 689
                         );
@@ -691,8 +691,8 @@  discard block
 block discarded – undo
691 691
                 } else if (is_dir($source)) {
692 692
                     // one source for directories
693 693
                     static::importFilesFromDir(
694
-                        rtrim($source, '/\\*') . '/*',
695
-                        !empty($destination) ? $destination . '/' : null,
694
+                        rtrim($source, '/\\*').'/*',
695
+                        !empty($destination) ? $destination.'/' : null,
696 696
                         true,
697 697
                         $files
698 698
                     );
Please login to merge, or discard this patch.
src/Formats.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -160,8 +160,9 @@
 block discarded – undo
160 160
         // by file content
161 161
         if ($contentCheck) {
162 162
             $mime_type = mime_content_type($fileName);
163
-            if (isset(static::$mimeTypes[$mime_type]))
164
-                return static::$mimeTypes[$mime_type];
163
+            if (isset(static::$mimeTypes[$mime_type])) {
164
+                            return static::$mimeTypes[$mime_type];
165
+            }
165 166
         }
166 167
 
167 168
         return false;
Please login to merge, or discard this patch.
src/Drivers/Zip.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
 
29 29
     public static function getDescription()
30 30
     {
31
-        return 'adapter for ext-zip'.(extension_loaded('zip') && defined('\ZipArchive::LIBZIP_VERSION') ? ' ('. ZipArchive::LIBZIP_VERSION.')' : null);
31
+        return 'adapter for ext-zip'.(extension_loaded('zip') && defined('\ZipArchive::LIBZIP_VERSION') ? ' ('.ZipArchive::LIBZIP_VERSION.')' : null);
32 32
     }
33 33
 
34 34
     public static function isInstalled()
Please login to merge, or discard this patch.
Braces   +36 added lines, -24 removed lines patch added patch discarded remove patch
@@ -86,8 +86,9 @@  discard block
 block discarded – undo
86 86
     {
87 87
         parent::__construct($archiveFileName, $format);
88 88
         $this->open($archiveFileName);
89
-        if ($password !== null)
90
-            $this->zip->setPassword($password);
89
+        if ($password !== null) {
90
+                    $this->zip->setPassword($password);
91
+        }
91 92
     }
92 93
 
93 94
     /**
@@ -121,8 +122,9 @@  discard block
 block discarded – undo
121 122
         for ($i = 0; $i < $this->zip->numFiles; $i++) {
122 123
             $file = $this->zip->statIndex($i);
123 124
             // skip directories
124
-            if (in_array(substr($file['name'], -1), ['/', '\\'], true))
125
-                continue;
125
+            if (in_array(substr($file['name'], -1), ['/', '\\'], true)) {
126
+                            continue;
127
+            }
126 128
             $this->pureFilesNumber++;
127 129
             $information->files[$i] = $file['name'];
128 130
             $information->compressedFilesSize += $file['comp_size'];
@@ -157,8 +159,9 @@  discard block
 block discarded – undo
157 159
         for ($i = 0; $i < $this->zip->numFiles; $i++) {
158 160
             $file_name = $this->zip->getNameIndex($i);
159 161
             // skip directories
160
-            if (in_array(substr($file_name, -1), ['/', '\\'], true))
161
-                continue;
162
+            if (in_array(substr($file_name, -1), ['/', '\\'], true)) {
163
+                            continue;
164
+            }
162 165
             $files[] = $file_name;
163 166
         }
164 167
         return $files;
@@ -203,8 +206,9 @@  discard block
 block discarded – undo
203 206
     public function getFileContent($fileName)
204 207
     {
205 208
         $result = $this->zip->getFromName($fileName);
206
-        if ($result === false)
207
-            throw new Exception('Could not get file information: '.$result.'. May use password?');
209
+        if ($result === false) {
210
+                    throw new Exception('Could not get file information: '.$result.'. May use password?');
211
+        }
208 212
         return $result;
209 213
     }
210 214
 
@@ -225,8 +229,9 @@  discard block
 block discarded – undo
225 229
      */
226 230
     public function extractFiles($outputFolder, array $files)
227 231
     {
228
-        if ($this->zip->extractTo($outputFolder, $files) === false)
229
-            throw new ArchiveExtractionException($this->zip->getStatusString(), $this->zip->status);
232
+        if ($this->zip->extractTo($outputFolder, $files) === false) {
233
+                    throw new ArchiveExtractionException($this->zip->getStatusString(), $this->zip->status);
234
+        }
230 235
 
231 236
         return count($files);
232 237
     }
@@ -238,8 +243,9 @@  discard block
 block discarded – undo
238 243
      */
239 244
     public function extractArchive($outputFolder)
240 245
     {
241
-        if ($this->zip->extractTo($outputFolder) === false)
242
-            throw new ArchiveExtractionException($this->zip->getStatusString(), $this->zip->status);
246
+        if ($this->zip->extractTo($outputFolder) === false) {
247
+                    throw new ArchiveExtractionException($this->zip->getStatusString(), $this->zip->status);
248
+        }
243 249
 
244 250
         return $this->pureFilesNumber;
245 251
     }
@@ -254,8 +260,9 @@  discard block
 block discarded – undo
254 260
     {
255 261
         $count = 0;
256 262
         foreach ($files as $file) {
257
-            if ($this->zip->deleteName($file) === false)
258
-                throw new ArchiveModificationException($this->zip->getStatusString(), $this->zip->status);
263
+            if ($this->zip->deleteName($file) === false) {
264
+                            throw new ArchiveModificationException($this->zip->getStatusString(), $this->zip->status);
265
+            }
259 266
             $count++;
260 267
         }
261 268
 
@@ -278,11 +285,13 @@  discard block
 block discarded – undo
278 285
         $added_files = 0;
279 286
         foreach ($files as $localName => $fileName) {
280 287
             if (is_null($fileName)) {
281
-                if ($this->zip->addEmptyDir($localName) === false)
282
-                    throw new ArchiveModificationException($this->zip->getStatusString(), $this->zip->status);
288
+                if ($this->zip->addEmptyDir($localName) === false) {
289
+                                    throw new ArchiveModificationException($this->zip->getStatusString(), $this->zip->status);
290
+                }
283 291
             } else {
284
-                if ($this->zip->addFile($fileName, $localName) === false)
285
-                    throw new ArchiveModificationException($this->zip->getStatusString(), $this->zip->status);
292
+                if ($this->zip->addFile($fileName, $localName) === false) {
293
+                                    throw new ArchiveModificationException($this->zip->getStatusString(), $this->zip->status);
294
+                }
286 295
                 $added_files++;
287 296
             }
288 297
         }
@@ -335,8 +344,9 @@  discard block
 block discarded – undo
335 344
         $zip = new ZipArchive();
336 345
         $result = $zip->open($archiveFileName, ZipArchive::CREATE);
337 346
 
338
-        if ($result !== true)
339
-            throw new ArchiveCreationException('ZipArchive error: '.$result);
347
+        if ($result !== true) {
348
+                    throw new ArchiveCreationException('ZipArchive error: '.$result);
349
+        }
340 350
 
341 351
         $can_set_compression_level = method_exists($zip, 'setCompressionName');
342 352
         $can_encrypt = static::canEncrypt(Formats::ZIP);
@@ -354,11 +364,13 @@  discard block
 block discarded – undo
354 364
 
355 365
         foreach ($files as $localName => $fileName) {
356 366
             if ($fileName === null) {
357
-                if ($zip->addEmptyDir($localName) === false)
358
-                    throw new ArchiveCreationException('Could not archive directory "'.$localName.'": '.$zip->getStatusString(), $zip->status);
367
+                if ($zip->addEmptyDir($localName) === false) {
368
+                                    throw new ArchiveCreationException('Could not archive directory "'.$localName.'": '.$zip->getStatusString(), $zip->status);
369
+                }
359 370
             } else {
360
-                if ($zip->addFile($fileName, $localName) === false)
361
-                    throw new ArchiveCreationException('Could not archive file "'.$fileName.'": '.$zip->getStatusString(), $zip->status);
371
+                if ($zip->addFile($fileName, $localName) === false) {
372
+                                    throw new ArchiveCreationException('Could not archive file "'.$fileName.'": '.$zip->getStatusString(), $zip->status);
373
+                }
362 374
                 if ($can_set_compression_level) {
363 375
                     $zip->setCompressionName($localName, $compressionLevelMap[$compressionLevel]);
364 376
                 }
Please login to merge, or discard this patch.
src/Drivers/OneFile/Bzip.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@
 block discarded – undo
7 7
 
8 8
 class Bzip extends OneFileDriver
9 9
 {
10
-    const FORMAT_SUFFIX =  'bz2';
10
+    const FORMAT_SUFFIX = 'bz2';
11 11
     const PHP_EXTENSION = 'bz2';
12 12
     const FORMAT = Formats::BZIP;
13 13
 
Please login to merge, or discard this patch.
src/Drivers/OneFile/OneFileDriver.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
 
32 32
     public static function getInstallationInstruction()
33 33
     {
34
-        return 'install `' . static::PHP_EXTENSION . '` extension';
34
+        return 'install `'.static::PHP_EXTENSION.'` extension';
35 35
     }
36 36
 
37 37
     public static function getSupportedFormats()
Please login to merge, or discard this patch.
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -59,10 +59,12 @@  discard block
 block discarded – undo
59 59
      */
60 60
     public function __construct($archiveFileName, $format, $password = null)
61 61
     {
62
-        if (static::FORMAT_SUFFIX === null)
63
-            throw new \Exception('Format should be initialized');
64
-        if ($password !== null)
65
-            throw new UnsupportedOperationException(self::FORMAT_SUFFIX.' archive does not support password!');
62
+        if (static::FORMAT_SUFFIX === null) {
63
+                    throw new \Exception('Format should be initialized');
64
+        }
65
+        if ($password !== null) {
66
+                    throw new UnsupportedOperationException(self::FORMAT_SUFFIX.' archive does not support password!');
67
+        }
66 68
 
67 69
         parent::__construct($archiveFileName, $format);
68 70
 
@@ -131,8 +133,9 @@  discard block
 block discarded – undo
131 133
     public function extractArchive($outputFolder)
132 134
     {
133 135
         $data = $this->getFileContent($this->inArchiveFileName);
134
-        if ($data === false)
135
-            throw new ArchiveExtractionException('Could not extract archive');
136
+        if ($data === false) {
137
+                    throw new ArchiveExtractionException('Could not extract archive');
138
+        }
136 139
 
137 140
         $size = strlen($data);
138 141
         $written = file_put_contents($outputFolder.$this->inArchiveFileName, $data);
Please login to merge, or discard this patch.
src/Drivers/OneFile/Lzma.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
  */
14 14
 class Lzma extends OneFileDriver
15 15
 {
16
-    const FORMAT_SUFFIX =  'xz';
16
+    const FORMAT_SUFFIX = 'xz';
17 17
     const PHP_EXTENSION = 'xz';
18 18
     const FORMAT = Formats::LZMA;
19 19
 
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
      */
31 31
     public static function getInstallationInstruction()
32 32
     {
33
-        return 'install [xz] extension' . "\n" . 'For 5.x: https://github.com/payden/php-xz' . "\n" . 'For 7.x/8.x: https://github.com/codemasher/php-ext-xz';
33
+        return 'install [xz] extension'."\n".'For 5.x: https://github.com/payden/php-xz'."\n".'For 7.x/8.x: https://github.com/codemasher/php-ext-xz';
34 34
     }
35 35
 
36 36
     /**
Please login to merge, or discard this patch.
src/Drivers/TarByPear.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
      */
54 54
     public static function getInstallationInstruction()
55 55
     {
56
-        return 'install library [pear/archive_tar]: `composer require pear/archive_tar`' . "\n"  . ' and optionally php-extensions (zlib, bz2)';
56
+        return 'install library [pear/archive_tar]: `composer require pear/archive_tar`'."\n".' and optionally php-extensions (zlib, bz2)';
57 57
     }
58 58
 
59 59
     /**
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
                 $compression = 'lzma2';
161 161
                 break;
162 162
             case 'z':
163
-                $tar_aname = 'compress.lzw://' . $archiveFileName;
163
+                $tar_aname = 'compress.lzw://'.$archiveFileName;
164 164
                 break;
165 165
         }
166 166
 
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 
218 218
             case Formats::TAR_LZW:
219 219
                 LzwStreamWrapper::registerWrapper();
220
-                $this->tar = new Archive_Tar('compress.lzw://' . $this->fileName);
220
+                $this->tar = new Archive_Tar('compress.lzw://'.$this->fileName);
221 221
                 break;
222 222
 
223 223
             default:
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
         $result = $this->tar->extractList($files, $outputFolder);
336 336
         if ($result === false) {
337 337
             if (isset($this->tar->error_object)) {
338
-                throw new ArchiveExtractionException('Error when extracting from ' . $this->fileName . ': ' . $this->tar->error_object->getMessage(0));
338
+                throw new ArchiveExtractionException('Error when extracting from '.$this->fileName.': '.$this->tar->error_object->getMessage(0));
339 339
             }
340 340
             throw new ArchiveExtractionException('Error when extracting from '.$this->fileName);
341 341
         }
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
         $result = $this->tar->extract($outputFolder);
352 352
         if ($result === false) {
353 353
             if (isset($this->tar->error_object)) {
354
-                throw new ArchiveExtractionException('Error when extracting ' . $this->fileName . ': '
354
+                throw new ArchiveExtractionException('Error when extracting '.$this->fileName.': '
355 355
                                                      . $this->tar->error_object->toString()
356 356
                 );
357 357
             }
Please login to merge, or discard this patch.
Braces   +23 added lines, -16 removed lines patch added patch discarded remove patch
@@ -164,10 +164,11 @@  discard block
 block discarded – undo
164 164
                 break;
165 165
         }
166 166
 
167
-        if (isset($tar_aname))
168
-            $tar = new Archive_Tar($tar_aname, $compression);
169
-        else
170
-            $tar = new Archive_Tar($archiveFileName, $compression);
167
+        if (isset($tar_aname)) {
168
+                    $tar = new Archive_Tar($tar_aname, $compression);
169
+        } else {
170
+                    $tar = new Archive_Tar($archiveFileName, $compression);
171
+        }
171 172
 
172 173
         $current_file = 0;
173 174
         $total_files = count($files);
@@ -179,8 +180,9 @@  discard block
 block discarded – undo
179 180
 //                if ($tar->addString($localName, '') === false)
180 181
 //                    throw new ArchiveCreationException('Error when adding directory '.$localName.' to archive');
181 182
             } else {
182
-                if ($tar->addModify($filename, $add_dir, $remove_dir) === false)
183
-                    throw new ArchiveCreationException('Error when adding file '.$filename.' to archive');
183
+                if ($tar->addModify($filename, $add_dir, $remove_dir) === false) {
184
+                                    throw new ArchiveCreationException('Error when adding file '.$filename.' to archive');
185
+                }
184 186
             }
185 187
             if ($fileProgressCallable !== null) {
186 188
                 call_user_func_array($fileProgressCallable, [$current_file++, $total_files, $filename, $localName]);
@@ -241,8 +243,9 @@  discard block
 block discarded – undo
241 243
                 continue;
242 244
             }
243 245
             // skip directories
244
-            if ($file['typeflag'] == '5' || substr($file['filename'], -1) === '/')
245
-                continue;
246
+            if ($file['typeflag'] == '5' || substr($file['filename'], -1) === '/') {
247
+                            continue;
248
+            }
246 249
             $information->files[] = $file['filename'];
247 250
             $information->uncompressedFilesSize += $file['size'];
248 251
             $this->pearFilesIndex[$file['filename']] = $i;
@@ -288,14 +291,16 @@  discard block
 block discarded – undo
288 291
      */
289 292
     public function getFileData($fileName)
290 293
     {
291
-        if (!isset($this->pearFilesIndex[$fileName]))
292
-            throw new NonExistentArchiveFileException('File '.$fileName.' is not found in archive files list');
294
+        if (!isset($this->pearFilesIndex[$fileName])) {
295
+                    throw new NonExistentArchiveFileException('File '.$fileName.' is not found in archive files list');
296
+        }
293 297
 
294 298
         $index = $this->pearFilesIndex[$fileName];
295 299
 
296 300
         $files_list = $this->tar->listContent();
297
-        if (!isset($files_list[$index]))
298
-            throw new NonExistentArchiveFileException('File '.$fileName.' is not found in Tar archive');
301
+        if (!isset($files_list[$index])) {
302
+                    throw new NonExistentArchiveFileException('File '.$fileName.' is not found in Tar archive');
303
+        }
299 304
 
300 305
         $data = $files_list[$index];
301 306
         unset($files_list);
@@ -310,8 +315,9 @@  discard block
 block discarded – undo
310 315
      */
311 316
     public function getFileContent($fileName)
312 317
     {
313
-        if (!isset($this->pearFilesIndex[$fileName]))
314
-            throw new NonExistentArchiveFileException('File '.$fileName.' is not found in archive files list');
318
+        if (!isset($this->pearFilesIndex[$fileName])) {
319
+                    throw new NonExistentArchiveFileException('File '.$fileName.' is not found in archive files list');
320
+        }
315 321
 
316 322
         return $this->tar->extractInString($fileName);
317 323
     }
@@ -321,8 +327,9 @@  discard block
 block discarded – undo
321 327
      */
322 328
     public function getFileStream($fileName)
323 329
     {
324
-        if (!isset($this->pearFilesIndex[$fileName]))
325
-            throw new NonExistentArchiveFileException('File '.$fileName.' is not found in archive files list');
330
+        if (!isset($this->pearFilesIndex[$fileName])) {
331
+                    throw new NonExistentArchiveFileException('File '.$fileName.' is not found in archive files list');
332
+        }
326 333
 
327 334
         return self::wrapStringInStream($this->tar->extractInString($fileName));
328 335
     }
Please login to merge, or discard this patch.