Passed
Push — master ( 3fc76b...c4daa3 )
by f
14:51
created
src/PclZipInterface.php 2 patches
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 
278 278
         $report = array();
279 279
         foreach ($this->listContent() as $file_header) {
280
-            $file_header = (object)$file_header;
280
+            $file_header = (object) $file_header;
281 281
             // add file information to report
282 282
             $report[] = $file_header;
283 283
             // refuse by select rule
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
         }
412 412
 
413 413
         foreach ($report as $i => $reportItem) {
414
-            $report[$i] = (array)$reportItem;
414
+            $report[$i] = (array) $reportItem;
415 415
         }
416 416
 
417 417
         return $report;
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
 
463 463
         $report = [];
464 464
         foreach ($this->listContent() as $file_header) {
465
-            $file_header = (object)$file_header;
465
+            $file_header = (object) $file_header;
466 466
             // select by select rule
467 467
             if (call_user_func($selectFilter, $file_header->stored_filename,
468 468
                     $file_header->filename, $file_header->index)
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
         }
483 483
 
484 484
         foreach ($report as $i => $reportItem) {
485
-            $report[$i] = (array)$reportItem;
485
+            $report[$i] = (array) $reportItem;
486 486
         }
487 487
 
488 488
         return $report;
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
             }
544 544
         }
545 545
 
546
-        call_user_func(function ($directory) {
546
+        call_user_func(function($directory) {
547 547
             foreach (glob($directory.'/*') as $f) {
548 548
                 if (is_dir($f)) call_user_func(__FUNCTION__, $f);
549 549
                 else unlink($f);
@@ -572,16 +572,16 @@  discard block
 block discarded – undo
572 572
         $filters = array();
573 573
         if (isset($options[PCLZIP_OPT_REMOVE_PATH])
574 574
             && !isset($options[PCLZIP_OPT_REMOVE_ALL_PATH]))
575
-            $filters[] = function (&$key, &$value) use ($options) {
575
+            $filters[] = function(&$key, &$value) use ($options) {
576 576
                 $key = str_replace($key, null, $key);
577 577
             };
578 578
         if (isset($options[PCLZIP_OPT_REMOVE_ALL_PATH]))
579
-            $filters[] = function (&$key, &$value) {
579
+            $filters[] = function(&$key, &$value) {
580 580
                 $key = basename($key);
581 581
             };
582 582
         if (isset($options[PCLZIP_OPT_ADD_PATH]))
583
-            $filters[] = function (&$key, &$value) use ($options) {
584
-                $key = rtrim($options[PCLZIP_OPT_ADD_PATH], '/') . '/' .
583
+            $filters[] = function(&$key, &$value) use ($options) {
584
+                $key = rtrim($options[PCLZIP_OPT_ADD_PATH], '/').'/'.
585 585
                     ltrim($key, '/');
586 586
             };
587 587
         return $filters;
@@ -595,7 +595,7 @@  discard block
 block discarded – undo
595 595
      */
596 596
     private function extractCallbacks(array $options, $preCallbackConst, $postCallbackConst)
597 597
     {
598
-        $preCallback = $postCallback = function () { return true; };
598
+        $preCallback = $postCallback = function() { return true; };
599 599
 
600 600
         if (isset($options[$preCallbackConst]) && is_callable($options[$preCallbackConst]))
601 601
             $preCallback = $options[$preCallbackConst];
@@ -613,8 +613,8 @@  discard block
 block discarded – undo
613 613
     private function makeKeyValueArrayFromList(array $options)
614 614
     {
615 615
         // @todo create version for 5.5 of ARRAY_FILTER_USE_KEY function or drop 5.5 support
616
-        $keys = array_filter($options, function ($v) {return ($v%2) == 0;}, ARRAY_FILTER_USE_KEY);
617
-        $values = array_filter($options, function ($v) {return ($v%2) == 1;}, ARRAY_FILTER_USE_KEY);
616
+        $keys = array_filter($options, function($v) {return ($v % 2) == 0; }, ARRAY_FILTER_USE_KEY);
617
+        $values = array_filter($options, function($v) {return ($v % 2) == 1; }, ARRAY_FILTER_USE_KEY);
618 618
         if (count($values) < count($keys)) $values[] = true;
619 619
         return array_combine($keys, $values);
620 620
     }
@@ -663,7 +663,7 @@  discard block
 block discarded – undo
663 663
                 range($parts[0], $parts[1]), $allowedIndexes);
664 664
         }
665 665
 
666
-        return function ($key, $value, $index) use ($allowedIndexes) {
666
+        return function($key, $value, $index) use ($allowedIndexes) {
667 667
             return in_array($index, $allowedIndexes)
668 668
                 ? self::SELECT_FILTER_PASS
669 669
                 : self::SELECT_FILTER_REFUSE;
@@ -680,7 +680,7 @@  discard block
 block discarded – undo
680 680
             ? $names
681 681
             : explode(',', $names);
682 682
 
683
-        return function ($key, $value) use ($allowedNames) {
683
+        return function($key, $value) use ($allowedNames) {
684 684
             foreach ($allowedNames as $name) {
685 685
                 // select directory with nested files
686 686
                 if (in_array(substr($name, -1), ['/', '\\'])) {
@@ -708,7 +708,7 @@  discard block
 block discarded – undo
708 708
      */
709 709
     protected function createByEregSelector($regex)
710 710
     {
711
-        return function ($key, $value) use ($regex) {
711
+        return function($key, $value) use ($regex) {
712 712
             return (ereg($regex, $key) !== false)
713 713
                 ? self::SELECT_FILTER_PASS
714 714
                 : self::SELECT_FILTER_REFUSE;
@@ -721,7 +721,7 @@  discard block
 block discarded – undo
721 721
      */
722 722
     protected function createByPregSelector($regex)
723 723
     {
724
-        return function ($key, $value) use ($regex) {
724
+        return function($key, $value) use ($regex) {
725 725
             return preg_match($regex, $key)
726 726
                 ? self::SELECT_FILTER_PASS
727 727
                 : self::SELECT_FILTER_REFUSE;
@@ -748,7 +748,7 @@  discard block
 block discarded – undo
748 748
             $selectFilter = $this->createByIndexSelector($options[PCLZIP_OPT_BY_INDEX]);
749 749
         // no rule
750 750
         else
751
-            $selectFilter = function () {
751
+            $selectFilter = function() {
752 752
                 return self::SELECT_FILTER_PASS;
753 753
             };
754 754
         return $selectFilter;
@@ -788,9 +788,9 @@  discard block
 block discarded – undo
788 788
         if (isset($options[PCLZIP_OPT_COMMENT]))
789 789
             $comment = $options[PCLZIP_OPT_COMMENT];
790 790
         else if (isset($options[PCLZIP_OPT_ADD_COMMENT])) {;
791
-            $comment = $currentComment . $options[PCLZIP_OPT_ADD_COMMENT];
791
+            $comment = $currentComment.$options[PCLZIP_OPT_ADD_COMMENT];
792 792
         } else if (isset($options[PCLZIP_OPT_PREPEND_COMMENT])) {
793
-            $comment = $options[PCLZIP_OPT_PREPEND_COMMENT] . $currentComment;
793
+            $comment = $options[PCLZIP_OPT_PREPEND_COMMENT].$currentComment;
794 794
         }
795 795
         return $comment;
796 796
     }
Please login to merge, or discard this patch.
Braces   +99 added lines, -57 removed lines patch added patch discarded remove patch
@@ -142,8 +142,11 @@  discard block
 block discarded – undo
142 142
      */
143 143
     public function create($content)
144 144
     {
145
-        if (is_array($content)) $paths_list = $content;
146
-        else $paths_list = explode(',', $content);
145
+        if (is_array($content)) {
146
+         $paths_list = $content;
147
+        } else {
148
+         $paths_list = explode(',', $content);
149
+        }
147 150
 
148 151
         $options = $this->makeOptionsFromArguments(func_get_args());
149 152
 
@@ -151,8 +154,9 @@  discard block
 block discarded – undo
151 154
         $filters = $this->createFilters($options);
152 155
         list($preAddCallback, $postAddCallback) = $this->extractCallbacks($options, PCLZIP_CB_PRE_ADD, PCLZIP_CB_POST_ADD);
153 156
 
154
-        if (!empty($comment = $this->buildComment($options, null)))
155
-            $this->archive->setComment($comment);
157
+        if (!empty($comment = $this->buildComment($options, null))) {
158
+                    $this->archive->setComment($comment);
159
+        }
156 160
 
157 161
         // scan filesystem for files list
158 162
         return $this->addSnippets($paths_list, $filters, $preAddCallback, $postAddCallback);
@@ -172,16 +176,18 @@  discard block
 block discarded – undo
172 176
             $localname = $fileToAdd;
173 177
             $filename = $fileToAdd;
174 178
 
175
-            foreach ($filters as $filter)
176
-                call_user_func($filter, $localname, $filename);
179
+            foreach ($filters as $filter) {
180
+                            call_user_func($filter, $localname, $filename);
181
+            }
177 182
 
178 183
             $file_header = $this->createFileHeader($localname, $filename);
179 184
             if (call_user_func($preAddCallback, $file_header) == 1) {
180 185
                 //
181 186
                 // Check for max length > 255
182 187
                 //
183
-                if (strlen(basename($file_header->stored_filename)) > 255)
184
-                    $file_header->status = 'filename_too_long';
188
+                if (strlen(basename($file_header->stored_filename)) > 255) {
189
+                                    $file_header->status = 'filename_too_long';
190
+                }
185 191
                 if (is_file($filename)) {
186 192
                     $this->archive->add([
187 193
                         $file_header->stored_filename => $file_header->filename,
@@ -253,27 +259,35 @@  discard block
 block discarded – undo
253 259
         }
254 260
 
255 261
         // filters initiation
256
-        if (isset($options[PCLZIP_OPT_PATH]))
257
-            $extractPath = rtrim($options[PCLZIP_OPT_PATH], '/');
258
-        else $extractPath = rtrim(getcwd(), '/');
262
+        if (isset($options[PCLZIP_OPT_PATH])) {
263
+                    $extractPath = rtrim($options[PCLZIP_OPT_PATH], '/');
264
+        } else {
265
+         $extractPath = rtrim(getcwd(), '/');
266
+        }
259 267
 
260 268
         $filters = $this->createFilters($options);
261 269
         list($preExtractCallback, $postExtractCallback) = $this->extractCallbacks($options, PCLZIP_CB_PRE_EXTRACT, PCLZIP_CB_POST_EXTRACT);
262 270
         $selectFilter = $this->createSelector($options);
263 271
 
264
-        if (isset($options[PCLZIP_OPT_EXTRACT_AS_STRING]))
265
-            $anotherOutputFormat = PCLZIP_OPT_EXTRACT_AS_STRING;
266
-        else if (isset($options[PCLZIP_OPT_EXTRACT_IN_OUTPUT]))
267
-            $anotherOutputFormat = PCLZIP_OPT_EXTRACT_IN_OUTPUT;
268
-        else $anotherOutputFormat = false;
272
+        if (isset($options[PCLZIP_OPT_EXTRACT_AS_STRING])) {
273
+                    $anotherOutputFormat = PCLZIP_OPT_EXTRACT_AS_STRING;
274
+        } else if (isset($options[PCLZIP_OPT_EXTRACT_IN_OUTPUT])) {
275
+                    $anotherOutputFormat = PCLZIP_OPT_EXTRACT_IN_OUTPUT;
276
+        } else {
277
+         $anotherOutputFormat = false;
278
+        }
269 279
 
270
-        if (isset($options[PCLZIP_OPT_REPLACE_NEWER]))
271
-            $doNotReplaceNewer = false;
272
-        else $doNotReplaceNewer = true;
280
+        if (isset($options[PCLZIP_OPT_REPLACE_NEWER])) {
281
+                    $doNotReplaceNewer = false;
282
+        } else {
283
+         $doNotReplaceNewer = true;
284
+        }
273 285
 
274
-        if (isset($options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION]))
275
-            $restrictExtractDir = $options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION];
276
-        else $restrictExtractDir = false;
286
+        if (isset($options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION])) {
287
+                    $restrictExtractDir = $options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION];
288
+        } else {
289
+         $restrictExtractDir = false;
290
+        }
277 291
 
278 292
         $report = array();
279 293
         foreach ($this->listContent() as $file_header) {
@@ -344,8 +358,10 @@  discard block
 block discarded – undo
344 358
             // extract content
345 359
             else if ($anotherOutputFormat === false) {
346 360
                 // apply path filters
347
-                foreach ($filters as $filter) call_user_func($filter,
361
+                foreach ($filters as $filter) {
362
+                 call_user_func($filter,
348 363
                     $file_header->stored_filename, $file_header->filename);
364
+                }
349 365
                 // dir extraction process
350 366
                 if ($file_header->folder) {
351 367
                     // if dir doesn't exist
@@ -436,15 +452,19 @@  discard block
 block discarded – undo
436 452
      */
437 453
     public function add($content)
438 454
     {
439
-        if (is_array($content)) $paths_list = $content;
440
-        else $paths_list = explode(',', $content);
455
+        if (is_array($content)) {
456
+         $paths_list = $content;
457
+        } else {
458
+         $paths_list = explode(',', $content);
459
+        }
441 460
 
442 461
         $options = $this->makeOptionsFromArguments(func_get_args());
443 462
         $filters = $this->createFilters($options);
444 463
         list($preAddCallback, $postAddCallback) = $this->extractCallbacks($options, PCLZIP_CB_PRE_ADD, PCLZIP_CB_POST_ADD);
445 464
 
446
-        if (!empty($comment = $this->buildComment($options, $this->archive->getComment())))
447
-            $this->archive->setComment($comment);
465
+        if (!empty($comment = $this->buildComment($options, $this->archive->getComment()))) {
466
+                    $this->archive->setComment($comment);
467
+        }
448 468
 
449 469
         // scan filesystem for files list
450 470
         return $this->addSnippets($paths_list, $filters, $preAddCallback, $postAddCallback);
@@ -516,8 +536,12 @@  discard block
 block discarded – undo
516 536
         }
517 537
 
518 538
         $tempDir = tempnam(PCLZIP_TEMPORARY_DIR, 'merging');
519
-        if (file_exists($tempDir)) unlink($tempDir);
520
-        if (!mkdir($tempDir)) return 0;
539
+        if (file_exists($tempDir)) {
540
+         unlink($tempDir);
541
+        }
542
+        if (!mkdir($tempDir)) {
543
+         return 0;
544
+        }
521 545
 
522 546
         // go through archive content list and copy all files
523 547
         foreach ($a->getFiles() as $filename) {
@@ -545,8 +569,11 @@  discard block
 block discarded – undo
545 569
 
546 570
         call_user_func(function ($directory) {
547 571
             foreach (glob($directory.'/*') as $f) {
548
-                if (is_dir($f)) call_user_func(__FUNCTION__, $f);
549
-                else unlink($f);
572
+                if (is_dir($f)) {
573
+                 call_user_func(__FUNCTION__, $f);
574
+                } else {
575
+                 unlink($f);
576
+                }
550 577
             }
551 578
         }, $tempDir);
552 579
 
@@ -571,18 +598,21 @@  discard block
 block discarded – undo
571 598
     {
572 599
         $filters = array();
573 600
         if (isset($options[PCLZIP_OPT_REMOVE_PATH])
574
-            && !isset($options[PCLZIP_OPT_REMOVE_ALL_PATH]))
575
-            $filters[] = function (&$key, &$value) use ($options) {
601
+            && !isset($options[PCLZIP_OPT_REMOVE_ALL_PATH])) {
602
+                    $filters[] = function (&$key, &$value) use ($options) {
576 603
                 $key = str_replace($key, null, $key);
604
+        }
577 605
             };
578
-        if (isset($options[PCLZIP_OPT_REMOVE_ALL_PATH]))
579
-            $filters[] = function (&$key, &$value) {
606
+        if (isset($options[PCLZIP_OPT_REMOVE_ALL_PATH])) {
607
+                    $filters[] = function (&$key, &$value) {
580 608
                 $key = basename($key);
609
+        }
581 610
             };
582
-        if (isset($options[PCLZIP_OPT_ADD_PATH]))
583
-            $filters[] = function (&$key, &$value) use ($options) {
611
+        if (isset($options[PCLZIP_OPT_ADD_PATH])) {
612
+                    $filters[] = function (&$key, &$value) use ($options) {
584 613
                 $key = rtrim($options[PCLZIP_OPT_ADD_PATH], '/') . '/' .
585 614
                     ltrim($key, '/');
615
+        }
586 616
             };
587 617
         return $filters;
588 618
     }
@@ -597,11 +627,13 @@  discard block
 block discarded – undo
597 627
     {
598 628
         $preCallback = $postCallback = function () { return true; };
599 629
 
600
-        if (isset($options[$preCallbackConst]) && is_callable($options[$preCallbackConst]))
601
-            $preCallback = $options[$preCallbackConst];
630
+        if (isset($options[$preCallbackConst]) && is_callable($options[$preCallbackConst])) {
631
+                    $preCallback = $options[$preCallbackConst];
632
+        }
602 633
 
603
-        if (isset($options[$postCallbackConst]) && is_callable($options[$postCallbackConst]))
604
-            $postCallback = $options[$postCallbackConst];
634
+        if (isset($options[$postCallbackConst]) && is_callable($options[$postCallbackConst])) {
635
+                    $postCallback = $options[$postCallbackConst];
636
+        }
605 637
 
606 638
         return [$preCallback, $postCallback];
607 639
     }
@@ -615,7 +647,9 @@  discard block
 block discarded – undo
615 647
         // @todo create version for 5.5 of ARRAY_FILTER_USE_KEY function or drop 5.5 support
616 648
         $keys = array_filter($options, function ($v) {return ($v%2) == 0;}, ARRAY_FILTER_USE_KEY);
617 649
         $values = array_filter($options, function ($v) {return ($v%2) == 1;}, ARRAY_FILTER_USE_KEY);
618
-        if (count($values) < count($keys)) $values[] = true;
650
+        if (count($values) < count($keys)) {
651
+         $values[] = true;
652
+        }
619 653
         return array_combine($keys, $values);
620 654
     }
621 655
 
@@ -658,9 +692,12 @@  discard block
 block discarded – undo
658 692
         $allowedIndexes = array();
659 693
         foreach ($indexes as $rule) {
660 694
             $parts = explode('-', $rule);
661
-            if (count($parts) == 1) $allowedIndexes[] = $rule;
662
-            else $allowedIndexes = array_merge(
695
+            if (count($parts) == 1) {
696
+             $allowedIndexes[] = $rule;
697
+            } else {
698
+             $allowedIndexes = array_merge(
663 699
                 range($parts[0], $parts[1]), $allowedIndexes);
700
+            }
664 701
         }
665 702
 
666 703
         return function ($key, $value, $index) use ($allowedIndexes) {
@@ -735,21 +772,26 @@  discard block
 block discarded – undo
735 772
     protected function createSelector(array $options)
736 773
     {
737 774
         // exact matching
738
-        if (isset($options[PCLZIP_OPT_BY_NAME]))
739
-            $selectFilter = $this->createByNameSelector($options[PCLZIP_OPT_BY_NAME]);
775
+        if (isset($options[PCLZIP_OPT_BY_NAME])) {
776
+                    $selectFilter = $this->createByNameSelector($options[PCLZIP_OPT_BY_NAME]);
777
+        }
740 778
         // <ereg> rule
741
-        else if (isset($options[PCLZIP_OPT_BY_EREG]) && function_exists('ereg'))
742
-            $selectFilter = $this->createByEregSelector($options[PCLZIP_OPT_BY_EREG]);
779
+        else if (isset($options[PCLZIP_OPT_BY_EREG]) && function_exists('ereg')) {
780
+                    $selectFilter = $this->createByEregSelector($options[PCLZIP_OPT_BY_EREG]);
781
+        }
743 782
         // <preg_match> rule
744
-        else if (isset($options[PCLZIP_OPT_BY_PREG]))
745
-            $selectFilter = $this->createByPregSelector($options[PCLZIP_OPT_BY_PREG]);
783
+        else if (isset($options[PCLZIP_OPT_BY_PREG])) {
784
+                    $selectFilter = $this->createByPregSelector($options[PCLZIP_OPT_BY_PREG]);
785
+        }
746 786
         // index rule
747
-        else if (isset($options[PCLZIP_OPT_BY_INDEX]))
748
-            $selectFilter = $this->createByIndexSelector($options[PCLZIP_OPT_BY_INDEX]);
787
+        else if (isset($options[PCLZIP_OPT_BY_INDEX])) {
788
+                    $selectFilter = $this->createByIndexSelector($options[PCLZIP_OPT_BY_INDEX]);
789
+        }
749 790
         // no rule
750
-        else
751
-            $selectFilter = function () {
791
+        else {
792
+                    $selectFilter = function () {
752 793
                 return self::SELECT_FILTER_PASS;
794
+        }
753 795
             };
754 796
         return $selectFilter;
755 797
     }
@@ -785,9 +827,9 @@  discard block
 block discarded – undo
785 827
     protected function buildComment(array $options, $currentComment)
786 828
     {
787 829
         $comment = null;
788
-        if (isset($options[PCLZIP_OPT_COMMENT]))
789
-            $comment = $options[PCLZIP_OPT_COMMENT];
790
-        else if (isset($options[PCLZIP_OPT_ADD_COMMENT])) {;
830
+        if (isset($options[PCLZIP_OPT_COMMENT])) {
831
+                    $comment = $options[PCLZIP_OPT_COMMENT];
832
+        } else if (isset($options[PCLZIP_OPT_ADD_COMMENT])) {;
791 833
             $comment = $currentComment . $options[PCLZIP_OPT_ADD_COMMENT];
792 834
         } else if (isset($options[PCLZIP_OPT_PREPEND_COMMENT])) {
793 835
             $comment = $options[PCLZIP_OPT_PREPEND_COMMENT] . $currentComment;
Please login to merge, or discard this patch.
src/Drivers/Basic/BasicPureDriver.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,6 +15,6 @@
 block discarded – undo
15 15
 
16 16
     public static function getInstallationInstruction()
17 17
     {
18
-        return 'install library [' . static::PACKAGE_NAME . ']: `composer require ' . static::PACKAGE_NAME . '`';
18
+        return 'install library ['.static::PACKAGE_NAME.']: `composer require '.static::PACKAGE_NAME.'`';
19 19
     }
20 20
 }
Please login to merge, or discard this patch.
src/UnifiedArchive.php 2 patches
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
     public static function open($fileName, $abilities = [], $password = null)
65 65
     {
66 66
         if (!file_exists($fileName) || !is_readable($fileName)) {
67
-            throw new InvalidArgumentException('Could not open file: ' . $fileName . ' is not readable');
67
+            throw new InvalidArgumentException('Could not open file: '.$fileName.' is not readable');
68 68
         }
69 69
 
70 70
         $format = Formats::detectArchiveFormat($fileName);
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
         if ($archiveName !== null) {
122 122
             $archiveType = Formats::detectArchiveFormat($archiveName, false);
123 123
             if ($archiveType === null) {
124
-                throw new UnsupportedArchiveException('Could not detect archive type for name "' . $archiveName . '"');
124
+                throw new UnsupportedArchiveException('Could not detect archive type for name "'.$archiveName.'"');
125 125
             }
126 126
         }
127 127
 
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
     )
188 188
     {
189 189
         if (file_exists($archiveName)) {
190
-            throw new FileAlreadyExistsException('Archive ' . $archiveName . ' already exists!');
190
+            throw new FileAlreadyExistsException('Archive '.$archiveName.' already exists!');
191 191
         }
192 192
 
193 193
         $info = static::prepareForArchiving($fileOrFiles, $archiveName);
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
         $fileProgressCallable = null
239 239
     )
240 240
     {
241
-        $info = static::prepareForArchiving($fileOrFiles, '.' . Formats::getFormatExtension($archiveFormat));
241
+        $info = static::prepareForArchiving($fileOrFiles, '.'.Formats::getFormatExtension($archiveFormat));
242 242
         try {
243 243
             $driver = static::getCreationDriver($archiveFormat, true, $password !== null);
244 244
         } catch (UnsupportedArchiveException $e) {
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
     protected static function getCreationDriver($archiveFormat, $inString, $encrypted)
263 263
     {
264 264
         if (!Formats::canCreate($archiveFormat)) {
265
-            throw new UnsupportedArchiveException('Unsupported archive type: ' . $archiveFormat);
265
+            throw new UnsupportedArchiveException('Unsupported archive type: '.$archiveFormat);
266 266
         }
267 267
 
268 268
         $abilities = [Abilities::CREATE];
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 
273 273
         if ($encrypted) {
274 274
             if (!Formats::canEncrypt($archiveFormat)) {
275
-                throw new UnsupportedOperationException('Archive type ' . $archiveFormat . ' can not be encrypted');
275
+                throw new UnsupportedOperationException('Archive type '.$archiveFormat.' can not be encrypted');
276 276
             }
277 277
             $abilities[] = Abilities::CREATE_ENCRYPTED;
278 278
         }
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
         /** @var BasicDriver $driver */
281 281
         $driver = Formats::getFormatDriver($archiveFormat, $abilities);
282 282
         if ($driver === null) {
283
-            throw new UnsupportedArchiveException('Unsupported archive type: ' . $archiveFormat . ' of archive ');
283
+            throw new UnsupportedArchiveException('Unsupported archive type: '.$archiveFormat.' of archive ');
284 284
         }
285 285
         return $driver;
286 286
     }
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
     public function getFileData($fileName)
481 481
     {
482 482
         if (!in_array($fileName, $this->files, true)) {
483
-            throw new NonExistentArchiveFileException('File ' . $fileName . ' does not exist in archive');
483
+            throw new NonExistentArchiveFileException('File '.$fileName.' does not exist in archive');
484 484
         }
485 485
 
486 486
         return $this->archive->getFileData($fileName);
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
     public function getFileContent($fileName)
497 497
     {
498 498
         if (!in_array($fileName, $this->files, true)) {
499
-            throw new NonExistentArchiveFileException('File ' . $fileName . ' does not exist in archive');
499
+            throw new NonExistentArchiveFileException('File '.$fileName.' does not exist in archive');
500 500
         }
501 501
 
502 502
         return $this->archive->getFileContent($fileName);
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
     public function getFileStream($fileName)
513 513
     {
514 514
         if (!in_array($fileName, $this->files, true)) {
515
-            throw new NonExistentArchiveFileException('File ' . $fileName . ' does not exist in archive');
515
+            throw new NonExistentArchiveFileException('File '.$fileName.' does not exist in archive');
516 516
         }
517 517
 
518 518
         return $this->archive->getFileStream($fileName);
@@ -647,7 +647,7 @@  discard block
 block discarded – undo
647 647
         $newFiles = [];
648 648
         foreach ($files as $file) {
649 649
             foreach ($archiveFiles as $archiveFile) {
650
-                if (fnmatch($file . '*', $archiveFile)) {
650
+                if (fnmatch($file.'*', $archiveFile)) {
651 651
                     $newFiles[] = $archiveFile;
652 652
                 }
653 653
             }
@@ -680,8 +680,8 @@  discard block
 block discarded – undo
680 680
                 if (is_array($source)) {
681 681
                     foreach ($source as $sourceItem) {
682 682
                         static::importFilesFromDir(
683
-                            rtrim($sourceItem, '/\\*') . '/*',
684
-                            !empty($destination) ? $destination . '/' : null,
683
+                            rtrim($sourceItem, '/\\*').'/*',
684
+                            !empty($destination) ? $destination.'/' : null,
685 685
                             true,
686 686
                             $files
687 687
                         );
@@ -689,8 +689,8 @@  discard block
 block discarded – undo
689 689
                 } else if (is_dir($source)) {
690 690
                     // one source for directories
691 691
                     static::importFilesFromDir(
692
-                        rtrim($source, '/\\*') . '/*',
693
-                        !empty($destination) ? $destination . '/' : null,
692
+                        rtrim($source, '/\\*').'/*',
693
+                        !empty($destination) ? $destination.'/' : null,
694 694
                         true,
695 695
                         $files
696 696
                     );
@@ -702,9 +702,9 @@  discard block
 block discarded – undo
702 702
         } else if (is_string($nodes)) { // passed one file or directory
703 703
             // if is directory
704 704
             if (is_dir($nodes)) {
705
-                $nodes = rtrim($nodes, '/\\*') . '/';
705
+                $nodes = rtrim($nodes, '/\\*').'/';
706 706
                 static::importFilesFromDir(
707
-                    $nodes . '*',
707
+                    $nodes.'*',
708 708
                     $nodes,
709 709
                     true,
710 710
                     $files
@@ -733,10 +733,10 @@  discard block
 block discarded – undo
733 733
 
734 734
         foreach (glob($source, GLOB_MARK) as $node) {
735 735
             if (in_array(substr($node, -1), ['/', '\\'], true) && $recursive) {
736
-                static::importFilesFromDir(str_replace('\\', '/', $node) . '*',
737
-                    $destination . basename($node) . '/', $recursive, $map);
736
+                static::importFilesFromDir(str_replace('\\', '/', $node).'*',
737
+                    $destination.basename($node).'/', $recursive, $map);
738 738
             } elseif (is_file($node) && is_readable($node)) {
739
-                $map[$destination . basename($node)] = $node;
739
+                $map[$destination.basename($node)] = $node;
740 740
             }
741 741
         }
742 742
     }
@@ -955,7 +955,7 @@  discard block
 block discarded – undo
955 955
     public static function archiveFile($file, $archiveName, $compressionLevel = BasicDriver::COMPRESSION_AVERAGE, $password = null)
956 956
     {
957 957
         if (!is_file($file)) {
958
-            throw new InvalidArgumentException($file . ' is not a valid file to archive');
958
+            throw new InvalidArgumentException($file.' is not a valid file to archive');
959 959
         }
960 960
 
961 961
         return static::create($file, $archiveName, $compressionLevel, $password) === 1;
@@ -976,7 +976,7 @@  discard block
 block discarded – undo
976 976
     public static function archiveDirectory($directory, $archiveName, $compressionLevel = BasicDriver::COMPRESSION_AVERAGE, $password = null)
977 977
     {
978 978
         if (!is_dir($directory) || !is_readable($directory))
979
-            throw new InvalidArgumentException($directory . ' is not a valid directory to archive');
979
+            throw new InvalidArgumentException($directory.' is not a valid directory to archive');
980 980
 
981 981
         return static::create($directory, $archiveName, $compressionLevel, $password) > 0;
982 982
     }
@@ -1138,7 +1138,7 @@  discard block
 block discarded – undo
1138 1138
     public function addFile($file, $inArchiveName = null)
1139 1139
     {
1140 1140
         if (!is_file($file))
1141
-            throw new InvalidArgumentException($file . ' is not a valid file to add in archive');
1141
+            throw new InvalidArgumentException($file.' is not a valid file to add in archive');
1142 1142
 
1143 1143
         return ($inArchiveName !== null
1144 1144
                 ? $this->add([$inArchiveName => $file])
@@ -1159,7 +1159,7 @@  discard block
 block discarded – undo
1159 1159
     public function addDirectory($directory, $inArchivePath = null)
1160 1160
     {
1161 1161
         if (!is_dir($directory) || !is_readable($directory))
1162
-            throw new InvalidArgumentException($directory . ' is not a valid directory to add in archive');
1162
+            throw new InvalidArgumentException($directory.' is not a valid directory to add in archive');
1163 1163
 
1164 1164
         return ($inArchivePath !== null
1165 1165
                 ? $this->add([$inArchivePath => $directory])
Please login to merge, or discard this patch.
Braces   +21 added lines, -15 removed lines patch added patch discarded remove patch
@@ -459,13 +459,15 @@  discard block
 block discarded – undo
459 459
      */
460 460
     public function getFiles($filter = null)
461 461
     {
462
-        if ($filter === null)
463
-            return $this->files;
462
+        if ($filter === null) {
463
+                    return $this->files;
464
+        }
464 465
 
465 466
         $result = [];
466 467
         foreach ($this->files as $file) {
467
-            if (fnmatch($filter, $file))
468
-                $result[] = $file;
468
+            if (fnmatch($filter, $file)) {
469
+                            $result[] = $file;
470
+            }
469 471
         }
470 472
         return $result;
471 473
     }
@@ -667,9 +669,9 @@  discard block
 block discarded – undo
667 669
         if (is_array($nodes)) {
668 670
             foreach ($nodes as $destination => $source) {
669 671
                 // new format
670
-                if (is_numeric($destination))
671
-                    $destination = $source;
672
-                else {
672
+                if (is_numeric($destination)) {
673
+                                    $destination = $source;
674
+                } else {
673 675
                     // old format
674 676
                     if (is_string($source) && !file_exists($source)) {
675 677
                         list($destination, $source) = [$source, $destination];
@@ -728,8 +730,9 @@  discard block
 block discarded – undo
728 730
         // $map[$destination] = rtrim($source, '/*');
729 731
         // do not map root archive folder
730 732
 
731
-        if ($destination !== null)
732
-            $map[$destination] = null;
733
+        if ($destination !== null) {
734
+                    $map[$destination] = null;
735
+        }
733 736
 
734 737
         foreach (glob($source, GLOB_MARK) as $node) {
735 738
             if (in_array(substr($node, -1), ['/', '\\'], true) && $recursive) {
@@ -975,8 +978,9 @@  discard block
 block discarded – undo
975 978
      */
976 979
     public static function archiveDirectory($directory, $archiveName, $compressionLevel = BasicDriver::COMPRESSION_AVERAGE, $password = null)
977 980
     {
978
-        if (!is_dir($directory) || !is_readable($directory))
979
-            throw new InvalidArgumentException($directory . ' is not a valid directory to archive');
981
+        if (!is_dir($directory) || !is_readable($directory)) {
982
+                    throw new InvalidArgumentException($directory . ' is not a valid directory to archive');
983
+        }
980 984
 
981 985
         return static::create($directory, $archiveName, $compressionLevel, $password) > 0;
982 986
     }
@@ -1137,8 +1141,9 @@  discard block
 block discarded – undo
1137 1141
      */
1138 1142
     public function addFile($file, $inArchiveName = null)
1139 1143
     {
1140
-        if (!is_file($file))
1141
-            throw new InvalidArgumentException($file . ' is not a valid file to add in archive');
1144
+        if (!is_file($file)) {
1145
+                    throw new InvalidArgumentException($file . ' is not a valid file to add in archive');
1146
+        }
1142 1147
 
1143 1148
         return ($inArchiveName !== null
1144 1149
                 ? $this->add([$inArchiveName => $file])
@@ -1158,8 +1163,9 @@  discard block
 block discarded – undo
1158 1163
      */
1159 1164
     public function addDirectory($directory, $inArchivePath = null)
1160 1165
     {
1161
-        if (!is_dir($directory) || !is_readable($directory))
1162
-            throw new InvalidArgumentException($directory . ' is not a valid directory to add in archive');
1166
+        if (!is_dir($directory) || !is_readable($directory)) {
1167
+                    throw new InvalidArgumentException($directory . ' is not a valid directory to add in archive');
1168
+        }
1163 1169
 
1164 1170
         return ($inArchivePath !== null
1165 1171
                 ? $this->add([$inArchivePath => $directory])
Please login to merge, or discard this patch.
src/Commands/TestCommand.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@
 block discarded – undo
27 27
 
28 28
         $errored = [];
29 29
         foreach ($files as $file) {
30
-            $output->write($file . ' ... ');
30
+            $output->write($file.' ... ');
31 31
             if ($archive->test($file, $hash) === true) {
32 32
                 $output->writeln('<info>ok</info>');
33 33
             } else {
Please login to merge, or discard this patch.
src/Commands/InfoCommand.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -27,15 +27,15 @@
 block discarded – undo
27 27
         $file = realpath($input->getArgument('archive'));
28 28
         $archive = $this->getArchive($input, $output);
29 29
 
30
-        $output->writeln('Filename: ' . $file . ' (changed <comment>' . $this->formatDate(filemtime($file)) . '</comment>)');
31
-        $output->writeln('Type: <info>' . $archive->getFormat() . '</info>, mime <info>' . $archive->getMimeType() . '</info> (via driver <comment>' . $archive->getDriverType() . '</comment>)');
32
-        $output->writeln('Contains: ' . $archive->countFiles() . ' file' . ($archive->countFiles() > 1 ? 's' : null));
30
+        $output->writeln('Filename: '.$file.' (changed <comment>'.$this->formatDate(filemtime($file)).'</comment>)');
31
+        $output->writeln('Type: <info>'.$archive->getFormat().'</info>, mime <info>'.$archive->getMimeType().'</info> (via driver <comment>'.$archive->getDriverType().'</comment>)');
32
+        $output->writeln('Contains: '.$archive->countFiles().' file'.($archive->countFiles() > 1 ? 's' : null));
33 33
         $output->writeln('Size:');
34
-        $output->writeln("\t". 'uncompressed: '.implode(' ', $this->formatSize($archive->getOriginalSize(), 2)));
35
-        $output->writeln("\t" . 'compressed: ' . implode(' ', $this->formatSize($archive->getCompressedSize(), 2)));
36
-        $output->writeln("\t" . 'ratio: <info>' . round($archive->getOriginalSize() / $archive->getCompressedSize(), 6) . '/1 (' . floor($archive->getCompressedSize() / $archive->getOriginalSize() * 100) . '%</info>)');
34
+        $output->writeln("\t".'uncompressed: '.implode(' ', $this->formatSize($archive->getOriginalSize(), 2)));
35
+        $output->writeln("\t".'compressed: '.implode(' ', $this->formatSize($archive->getCompressedSize(), 2)));
36
+        $output->writeln("\t".'ratio: <info>'.round($archive->getOriginalSize() / $archive->getCompressedSize(), 6).'/1 ('.floor($archive->getCompressedSize() / $archive->getOriginalSize() * 100).'%</info>)');
37 37
         if ($archive->getDriver()->checkAbility(Abilities::GET_COMMENT) && !empty($comment = $archive->getComment()))
38
-            $output->writeln('Comment: <comment>' . $comment . '</comment>');
38
+            $output->writeln('Comment: <comment>'.$comment.'</comment>');
39 39
 
40 40
         return 0;
41 41
     }
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,8 +34,9 @@
 block discarded – undo
34 34
         $output->writeln("\t". 'uncompressed: '.implode(' ', $this->formatSize($archive->getOriginalSize(), 2)));
35 35
         $output->writeln("\t" . 'compressed: ' . implode(' ', $this->formatSize($archive->getCompressedSize(), 2)));
36 36
         $output->writeln("\t" . 'ratio: <info>' . round($archive->getOriginalSize() / $archive->getCompressedSize(), 6) . '/1 (' . floor($archive->getCompressedSize() / $archive->getOriginalSize() * 100) . '%</info>)');
37
-        if ($archive->getDriver()->checkAbility(Abilities::GET_COMMENT) && !empty($comment = $archive->getComment()))
38
-            $output->writeln('Comment: <comment>' . $comment . '</comment>');
37
+        if ($archive->getDriver()->checkAbility(Abilities::GET_COMMENT) && !empty($comment = $archive->getComment())) {
38
+                    $output->writeln('Comment: <comment>' . $comment . '</comment>');
39
+        }
39 40
 
40 41
         return 0;
41 42
     }
Please login to merge, or discard this patch.
src/Commands/FormatsCommand.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -33,9 +33,9 @@  discard block
 block discarded – undo
33 33
         if ($driver !== null) {
34 34
             $driver = $this->resolveDriverName($driver);
35 35
             if (!class_exists($driver) || !is_a($driver, BasicDriver::class, true)) {
36
-                throw new \InvalidArgumentException('Class "' . $driver . '" not found or not in BasicDriver children');
36
+                throw new \InvalidArgumentException('Class "'.$driver.'" not found or not in BasicDriver children');
37 37
             }
38
-            $output->writeln('Supported formats by <info>' . $driver . '</info>');
38
+            $output->writeln('Supported formats by <info>'.$driver.'</info>');
39 39
 
40 40
             $headers = array_keys(self::$abilitiesLabels);
41 41
             array_unshift($headers, 'format');
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
         $table->render();
89 89
 
90 90
         foreach (array_combine(array_values(self::$abilitiesShortCuts), array_keys(self::$abilitiesLabels)) as $shortCut => $label) {
91
-            $output->writeln('<info>' . $shortCut . '</info> - ' . $label);
91
+            $output->writeln('<info>'.$shortCut.'</info> - '.$label);
92 92
         }
93 93
 
94 94
         return 0;
Please login to merge, or discard this patch.
src/Commands/BaseArchiveCommand.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -29,20 +29,20 @@
 block discarded – undo
29 29
     protected function getArchive(InputInterface $input, OutputInterface $output)
30 30
     {
31 31
         $file = realpath($input->getArgument('archive'));
32
-        $output->writeln('<comment>Opening ' . $file . '</comment>', OutputInterface::VERBOSITY_VERY_VERBOSE);
32
+        $output->writeln('<comment>Opening '.$file.'</comment>', OutputInterface::VERBOSITY_VERY_VERBOSE);
33 33
         if (!is_file($file)) {
34
-            throw new \InvalidArgumentException('File ' . $input->getArgument('archive') . ' is not accessible');
34
+            throw new \InvalidArgumentException('File '.$input->getArgument('archive').' is not accessible');
35 35
         }
36
-        $output->writeln('<comment>Format ' . Formats::detectArchiveFormat($file) . '</comment>', OutputInterface::VERBOSITY_VERY_VERBOSE);
36
+        $output->writeln('<comment>Format '.Formats::detectArchiveFormat($file).'</comment>', OutputInterface::VERBOSITY_VERY_VERBOSE);
37 37
         $password = $input->getOption('password');
38 38
         if (empty($password)) {
39 39
             $password = null;
40 40
         } else {
41
-            $output->writeln('<comment>Passing password: ' . strlen($password).'</comment>', OutputInterface::VERBOSITY_VERY_VERBOSE);
41
+            $output->writeln('<comment>Passing password: '.strlen($password).'</comment>', OutputInterface::VERBOSITY_VERY_VERBOSE);
42 42
         }
43 43
         $archive = $this->open($file, $password);
44
-        $output->writeln('<comment>Driver ' . $archive->getDriverType() . '</comment>', OutputInterface::VERBOSITY_VERBOSE);
45
-        $output->writeln('<comment>Driver abilities: ' . implode(', ', $this->getDriverFormatAbilities($archive->getDriverType(), $archive->getFormat())) . '</comment>', OutputInterface::VERBOSITY_VERBOSE);
44
+        $output->writeln('<comment>Driver '.$archive->getDriverType().'</comment>', OutputInterface::VERBOSITY_VERBOSE);
45
+        $output->writeln('<comment>Driver abilities: '.implode(', ', $this->getDriverFormatAbilities($archive->getDriverType(), $archive->getFormat())).'</comment>', OutputInterface::VERBOSITY_VERBOSE);
46 46
         return $archive;
47 47
     }
48 48
 
Please login to merge, or discard this patch.
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
         $headers = array_keys(self::$abilitiesLabels);
Please login to merge, or discard this patch.