Passed
Push — master ( afad4e...ae0184 )
by f
40:32 queued 25:34
created
src/UnifiedArchive.php 1 patch
Spacing   +25 added lines, -25 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);
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
     public function getFileData($fileName)
288 288
     {
289 289
         if (!in_array($fileName, $this->files, true)) {
290
-            throw new NonExistentArchiveFileException('File ' . $fileName . ' does not exist in archive');
290
+            throw new NonExistentArchiveFileException('File '.$fileName.' does not exist in archive');
291 291
         }
292 292
 
293 293
         return $this->archive->getFileData($fileName);
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
     public function getFileContent($fileName)
304 304
     {
305 305
         if (!in_array($fileName, $this->files, true)) {
306
-            throw new NonExistentArchiveFileException('File ' . $fileName . ' does not exist in archive');
306
+            throw new NonExistentArchiveFileException('File '.$fileName.' does not exist in archive');
307 307
         }
308 308
 
309 309
         return $this->archive->getFileContent($fileName);
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
     public function getFileStream($fileName)
320 320
     {
321 321
         if (!in_array($fileName, $this->files, true)) {
322
-            throw new NonExistentArchiveFileException('File ' . $fileName . ' does not exist in archive');
322
+            throw new NonExistentArchiveFileException('File '.$fileName.' does not exist in archive');
323 323
         }
324 324
 
325 325
         return $this->archive->getFileStream($fileName);
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
     public function addFile($file, $inArchiveName = null)
417 417
     {
418 418
         if (!is_file($file))
419
-            throw new InvalidArgumentException($file . ' is not a valid file to add in archive');
419
+            throw new InvalidArgumentException($file.' is not a valid file to add in archive');
420 420
 
421 421
         return ($inArchiveName !== null
422 422
                 ? $this->add([$inArchiveName => $file])
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
     public function addDirectory($directory, $inArchivePath = null)
451 451
     {
452 452
         if (!is_dir($directory) || !is_readable($directory))
453
-            throw new InvalidArgumentException($directory . ' is not a valid directory to add in archive');
453
+            throw new InvalidArgumentException($directory.' is not a valid directory to add in archive');
454 454
 
455 455
         return ($inArchivePath !== null
456 456
                 ? $this->add([$inArchivePath => $directory])
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
         if ($archiveName !== null) {
501 501
             $archiveType = Formats::detectArchiveFormat($archiveName, false);
502 502
             if ($archiveType === false) {
503
-                throw new UnsupportedArchiveException('Could not detect archive type for name "' . $archiveName . '"');
503
+                throw new UnsupportedArchiveException('Could not detect archive type for name "'.$archiveName.'"');
504 504
             }
505 505
         }
506 506
 
@@ -562,17 +562,17 @@  discard block
 block discarded – undo
562 562
     )
563 563
     {
564 564
         if (file_exists($archiveName))
565
-            throw new FileAlreadyExistsException('Archive ' . $archiveName . ' already exists!');
565
+            throw new FileAlreadyExistsException('Archive '.$archiveName.' already exists!');
566 566
 
567 567
         $info = static::prepareForArchiving($fileOrFiles, $archiveName);
568 568
 
569 569
         $abilities = [BasicDriver::CREATE];
570 570
 
571 571
         if (!Formats::canCreate($info['type']))
572
-            throw new UnsupportedArchiveException('Unsupported archive type: ' . $info['type'] . ' of archive ' . $archiveName);
572
+            throw new UnsupportedArchiveException('Unsupported archive type: '.$info['type'].' of archive '.$archiveName);
573 573
 
574 574
         if ($password !== null && !Formats::canEncrypt($info['type']))
575
-            throw new UnsupportedOperationException('Archive type ' . $info['type'] . ' can not be encrypted');
575
+            throw new UnsupportedOperationException('Archive type '.$info['type'].' can not be encrypted');
576 576
         if ($password !== null) {
577 577
             $abilities[] = BasicDriver::CREATE_ENCRYPTED;
578 578
         }
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
         /** @var BasicDriver $driver */
581 581
         $driver = Formats::getFormatDriver($info['type'], $abilities);
582 582
         if ($driver === null) {
583
-            throw new UnsupportedArchiveException('Unsupported archive type: ' . $info['type'] . ' of archive ');
583
+            throw new UnsupportedArchiveException('Unsupported archive type: '.$info['type'].' of archive ');
584 584
         }
585 585
 
586 586
         return $driver::createArchive(
@@ -632,11 +632,11 @@  discard block
 block discarded – undo
632 632
         $info = static::prepareForArchiving($fileOrFiles);
633 633
         $abilities = [BasicDriver::CREATE, BasicDriver::CREATE_IN_STRING];
634 634
         if (!Formats::canCreate($info['type'])) {
635
-            throw new UnsupportedArchiveException('Unsupported archive type: ' . $info['type'] . ' of archive ' . $archiveName);
635
+            throw new UnsupportedArchiveException('Unsupported archive type: '.$info['type'].' of archive '.$archiveName);
636 636
         }
637 637
 
638 638
         if ($password !== null && !Formats::canEncrypt($info['type'])) {
639
-            throw new UnsupportedOperationException('Archive type ' . $info['type'] . ' can not be encrypted');
639
+            throw new UnsupportedOperationException('Archive type '.$info['type'].' can not be encrypted');
640 640
         }
641 641
         if ($password !== null) {
642 642
             $abilities[] = BasicDriver::CREATE_ENCRYPTED;
@@ -645,7 +645,7 @@  discard block
 block discarded – undo
645 645
         /** @var BasicDriver $driver */
646 646
         $driver = Formats::getFormatDriver($info['type'], $abilities);
647 647
         if ($driver === null) {
648
-            throw new UnsupportedArchiveException('Unsupported archive type: ' . $info['type'] . ' of archive ');
648
+            throw new UnsupportedArchiveException('Unsupported archive type: '.$info['type'].' of archive ');
649 649
         }
650 650
 
651 651
         return $driver::createArchiveInString(
@@ -671,7 +671,7 @@  discard block
 block discarded – undo
671 671
     public static function archiveFile($file, $archiveName, $compressionLevel = BasicDriver::COMPRESSION_AVERAGE, $password = null)
672 672
     {
673 673
         if (!is_file($file)) {
674
-            throw new InvalidArgumentException($file . ' is not a valid file to archive');
674
+            throw new InvalidArgumentException($file.' is not a valid file to archive');
675 675
         }
676 676
 
677 677
         return static::archive($file, $archiveName, $compressionLevel, $password) === 1;
@@ -691,7 +691,7 @@  discard block
 block discarded – undo
691 691
     public static function archiveDirectory($directory, $archiveName, $compressionLevel = BasicDriver::COMPRESSION_AVERAGE, $password = null)
692 692
     {
693 693
         if (!is_dir($directory) || !is_readable($directory))
694
-            throw new InvalidArgumentException($directory . ' is not a valid directory to archive');
694
+            throw new InvalidArgumentException($directory.' is not a valid directory to archive');
695 695
 
696 696
         return static::archive($directory, $archiveName, $compressionLevel, $password) > 0;
697 697
     }
@@ -707,7 +707,7 @@  discard block
 block discarded – undo
707 707
         $newFiles = [];
708 708
         foreach ($files as $file) {
709 709
             foreach ($archiveFiles as $archiveFile) {
710
-                if (fnmatch($file . '*', $archiveFile)) {
710
+                if (fnmatch($file.'*', $archiveFile)) {
711 711
                     $newFiles[] = $archiveFile;
712 712
                 }
713 713
             }
@@ -742,8 +742,8 @@  discard block
 block discarded – undo
742 742
                 if (is_array($source)) {
743 743
                     foreach ($source as $sourceItem) {
744 744
                         static::importFilesFromDir(
745
-                            rtrim($sourceItem, '/\\*') . '/*',
746
-                            !empty($destination) ? $destination . '/' : null,
745
+                            rtrim($sourceItem, '/\\*').'/*',
746
+                            !empty($destination) ? $destination.'/' : null,
747 747
                             true,
748 748
                             $files
749 749
                         );
@@ -751,8 +751,8 @@  discard block
 block discarded – undo
751 751
                 } else if (is_dir($source)) {
752 752
                     // one source for directories
753 753
                     static::importFilesFromDir(
754
-                        rtrim($source, '/\\*') . '/*',
755
-                        !empty($destination) ? $destination . '/' : null,
754
+                        rtrim($source, '/\\*').'/*',
755
+                        !empty($destination) ? $destination.'/' : null,
756 756
                         true,
757 757
                         $files
758 758
                     );
@@ -764,7 +764,7 @@  discard block
 block discarded – undo
764 764
         } else if (is_string($nodes)) { // passed one file or directory
765 765
             // if is directory
766 766
             if (is_dir($nodes))
767
-                static::importFilesFromDir(rtrim($nodes, '/\\*') . '/*', null, true,
767
+                static::importFilesFromDir(rtrim($nodes, '/\\*').'/*', null, true,
768 768
                     $files);
769 769
             else if (is_file($nodes))
770 770
                 $files[basename($nodes)] = $nodes;
@@ -789,10 +789,10 @@  discard block
 block discarded – undo
789 789
 
790 790
         foreach (glob($source, GLOB_MARK) as $node) {
791 791
             if (in_array(substr($node, -1), ['/', '\\'], true) && $recursive) {
792
-                static::importFilesFromDir(str_replace('\\', '/', $node) . '*',
793
-                    $destination . basename($node) . '/', $recursive, $map);
792
+                static::importFilesFromDir(str_replace('\\', '/', $node).'*',
793
+                    $destination.basename($node).'/', $recursive, $map);
794 794
             } elseif (is_file($node) && is_readable($node)) {
795
-                $map[$destination . basename($node)] = $node;
795
+                $map[$destination.basename($node)] = $node;
796 796
             }
797 797
         }
798 798
     }
Please login to merge, or discard this patch.