Passed
Branch master (ee136d)
by f
13:27
created
src/PclzipZipInterface.php 1 patch
Spacing   +37 added lines, -38 removed lines patch added patch discarded remove patch
@@ -147,8 +147,8 @@  discard block
 block discarded – undo
147 147
             }
148 148
         } else {
149 149
             $options = array_combine(
150
-                array_filter($options, function ($v) {return (bool) $v&2;}),
151
-                array_filter($options, function ($v) {return (bool) ($v-1)&2;})
150
+                array_filter($options, function($v) {return (bool) $v & 2; }),
151
+                array_filter($options, function($v) {return (bool) ($v - 1) & 2; })
152 152
             );
153 153
         }
154 154
 
@@ -156,12 +156,12 @@  discard block
 block discarded – undo
156 156
         $filters = array();
157 157
         if (isset($options[PCLZIP_OPT_REMOVE_PATH])
158 158
             && !isset($options[PCLZIP_OPT_REMOVE_ALL_PATH]))
159
-            $filters[] = function (&$key, &$value) use ($options) {
159
+            $filters[] = function(&$key, &$value) use ($options) {
160 160
                 $key = str_replace($key, null, $key); };
161 161
         if (isset($options[PCLZIP_OPT_REMOVE_ALL_PATH]))
162
-            $filters[] = function (&$key, &$value) { $key = basename($key); };
162
+            $filters[] = function(&$key, &$value) { $key = basename($key); };
163 163
         if (isset($options[PCLZIP_OPT_ADD_PATH]))
164
-            $filters[] = function (&$key, &$value) use ($options) {
164
+            $filters[] = function(&$key, &$value) use ($options) {
165 165
                 $key = rtrim($options[PCLZIP_OPT_ADD_PATH], '/').'/'.
166 166
                     ltrim($key, '/');
167 167
             };
@@ -169,12 +169,12 @@  discard block
 block discarded – undo
169 169
         if (isset($options[PCLZIP_CB_PRE_ADD])
170 170
             && is_callable($options[PCLZIP_CB_PRE_ADD]))
171 171
             $preAddCallback = $options[PCLZIP_CB_PRE_ADD];
172
-        else $preAddCallback = function () { return 1; };
172
+        else $preAddCallback = function() { return 1; };
173 173
 
174 174
         if (isset($options[PCLZIP_CB_POST_ADD])
175 175
             && is_callable($options[PCLZIP_CB_POST_ADD]))
176 176
             $postAddCallback = $options[PCLZIP_CB_POST_ADD];
177
-        else $postAddCallback = function () { return 1; };
177
+        else $postAddCallback = function() { return 1; };
178 178
 
179 179
         if (isset($options[PCLZIP_OPT_COMMENT]))
180 180
             $this->archive->setArchiveComment($options[PCLZIP_OPT_COMMENT]);
@@ -248,8 +248,7 @@  discard block
 block discarded – undo
248 248
                 'size' => $statIndex['size'],
249 249
                 'compressed_size' => $statIndex['comp_size'],
250 250
                 'mtime' => $statIndex,
251
-                'comment' => ($comment = $this->archive->getCommentIndex
252
-                    ($statIndex['index']) !== false) ? $comment : null,
251
+                'comment' => ($comment = $this->archive->getCommentIndex($statIndex['index']) !== false) ? $comment : null,
253 252
                 'folder' => in_array(substr($statIndex['name'], -1),
254 253
                     array('/', '\\')),
255 254
                 'index' => $statIndex['index'],
@@ -279,8 +278,8 @@  discard block
 block discarded – undo
279 278
             }
280 279
         } else {
281 280
             $options = array_combine(
282
-                array_filter($options, function ($v) {return (bool) $v&2;}),
283
-                array_filter($options, function ($v) {return (bool) ($v-1)&2;})
281
+                array_filter($options, function($v) {return (bool) $v & 2; }),
282
+                array_filter($options, function($v) {return (bool) ($v - 1) & 2; })
284 283
             );
285 284
         }
286 285
 
@@ -292,13 +291,13 @@  discard block
 block discarded – undo
292 291
         $filters = array();
293 292
         if (isset($options[PCLZIP_OPT_REMOVE_PATH])
294 293
             && !isset($options[PCLZIP_OPT_REMOVE_ALL_PATH]))
295
-            $filters[] = function (&$key, &$value) use ($options) {
294
+            $filters[] = function(&$key, &$value) use ($options) {
296 295
                 $key = str_replace($key, null, $key);
297 296
             };
298 297
         if (isset($options[PCLZIP_OPT_REMOVE_ALL_PATH]))
299
-            $filters[] = function (&$key, &$value) { $key = basename($key); };
298
+            $filters[] = function(&$key, &$value) { $key = basename($key); };
300 299
         if (isset($options[PCLZIP_OPT_ADD_PATH]))
301
-            $filters[] = function (&$key, &$value) use ($options) {
300
+            $filters[] = function(&$key, &$value) use ($options) {
302 301
                 $key = rtrim($options[PCLZIP_OPT_ADD_PATH], '/').'/'.
303 302
                     ltrim($key, '/');
304 303
             };
@@ -306,16 +305,16 @@  discard block
 block discarded – undo
306 305
         if (isset($options[PCLZIP_CB_PRE_EXTRACT])
307 306
             && is_callable($options[PCLZIP_CB_PRE_EXTRACT]))
308 307
             $preExtractCallback = $options[PCLZIP_CB_PRE_EXTRACT];
309
-        else $preExtractCallback = function () { return 1; };
308
+        else $preExtractCallback = function() { return 1; };
310 309
 
311 310
         if (isset($options[PCLZIP_CB_POST_EXTRACT])
312 311
             && is_callable($options[PCLZIP_CB_POST_EXTRACT]))
313 312
             $postExtractCallback = $options[PCLZIP_CB_POST_EXTRACT];
314
-        else $postExtractCallback = function () { return 1; };
313
+        else $postExtractCallback = function() { return 1; };
315 314
 
316 315
         // exact matching
317 316
         if (isset($options[PCLZIP_OPT_BY_NAME]))
318
-            $selectFilter = function ($key, $value) use ($options) {
317
+            $selectFilter = function($key, $value) use ($options) {
319 318
                 $allowedNames = is_array($options[PCLZIP_OPT_BY_NAME])
320 319
                     ? $options[PCLZIP_OPT_BY_NAME]
321 320
                     : explode(',', $options[PCLZIP_OPT_BY_NAME]);
@@ -340,21 +339,21 @@  discard block
 block discarded – undo
340 339
             };
341 340
         // <ereg> rule
342 341
         else if (isset($options[PCLZIP_OPT_BY_EREG]) && function_exists('ereg'))
343
-            $selectFilter = function ($key, $value) use ($options) {
342
+            $selectFilter = function($key, $value) use ($options) {
344 343
                 return (ereg($options[PCLZIP_OPT_BY_EREG], $key) !== false)
345 344
                     ? self::SELECT_FILTER_PASS
346 345
                     : self::SELECT_FILTER_REFUSE;
347 346
             };
348 347
         // <preg_match> rule
349 348
         else if (isset($options[PCLZIP_OPT_BY_PREG]))
350
-            $selectFilter = function ($key, $value) use ($options) {
349
+            $selectFilter = function($key, $value) use ($options) {
351 350
                 return preg_match($options[PCLZIP_OPT_BY_PREG], $key)
352 351
                     ? self::SELECT_FILTER_PASS
353 352
                     : self::SELECT_FILTER_REFUSE;
354 353
             };
355 354
         // index rule
356 355
         else if (isset($options[PCLZIP_OPT_BY_INDEX]))
357
-            $selectFilter = function ($key, $value, $index) use ($options) {
356
+            $selectFilter = function($key, $value, $index) use ($options) {
358 357
                 $allowedIndexes = array();
359 358
                 foreach ($options[PCLZIP_OPT_BY_INDEX] as $rule) {
360 359
                     $parts = explode('-', $rule);
@@ -368,7 +367,7 @@  discard block
 block discarded – undo
368 367
             };
369 368
         // no rule
370 369
         else
371
-            $selectFilter = function () { return self::SELECT_FILTER_PASS; };
370
+            $selectFilter = function() { return self::SELECT_FILTER_PASS; };
372 371
 
373 372
         if (isset($options[PCLZIP_OPT_EXTRACT_AS_STRING]))
374 373
             $anotherOutputFormat = PCLZIP_OPT_EXTRACT_AS_STRING;
@@ -560,8 +559,8 @@  discard block
 block discarded – undo
560 559
             }
561 560
         } else {
562 561
             $options = array_combine(
563
-                array_filter($options, function ($v) {return (bool) $v&2;}),
564
-                array_filter($options, function ($v) {return (bool) ($v-1)&2;})
562
+                array_filter($options, function($v) {return (bool) $v & 2; }),
563
+                array_filter($options, function($v) {return (bool) ($v - 1) & 2; })
565 564
             );
566 565
         }
567 566
 
@@ -569,13 +568,13 @@  discard block
 block discarded – undo
569 568
         $filters = array();
570 569
         if (isset($options[PCLZIP_OPT_REMOVE_PATH])
571 570
             && !isset($options[PCLZIP_OPT_REMOVE_ALL_PATH]))
572
-            $filters[] = function (&$key, &$value) use ($options) {
571
+            $filters[] = function(&$key, &$value) use ($options) {
573 572
                 $key = str_replace($key, null, $key);
574 573
             };
575 574
         if (isset($options[PCLZIP_OPT_REMOVE_ALL_PATH]))
576
-            $filters[] = function (&$key, &$value) { $key = basename($key); };
575
+            $filters[] = function(&$key, &$value) { $key = basename($key); };
577 576
         if (isset($options[PCLZIP_OPT_ADD_PATH]))
578
-            $filters[] = function (&$key, &$value) use ($options) {
577
+            $filters[] = function(&$key, &$value) use ($options) {
579 578
                 $key = rtrim($options[PCLZIP_OPT_ADD_PATH], '/').'/'.
580 579
                     ltrim($key, '/');
581 580
             };
@@ -583,12 +582,12 @@  discard block
 block discarded – undo
583 582
         if (isset($options[PCLZIP_CB_PRE_ADD])
584 583
             && is_callable($options[PCLZIP_CB_PRE_ADD]))
585 584
             $preAddCallback = $options[PCLZIP_CB_PRE_ADD];
586
-        else $preAddCallback = function () { return 1; };
585
+        else $preAddCallback = function() { return 1; };
587 586
 
588 587
         if (isset($options[PCLZIP_CB_POST_ADD])
589 588
             && is_callable($options[PCLZIP_CB_POST_ADD]))
590 589
             $postAddCallback = $options[PCLZIP_CB_POST_ADD];
591
-        else $postAddCallback = function () { return 1; };
590
+        else $postAddCallback = function() { return 1; };
592 591
 
593 592
         if (isset($options[PCLZIP_OPT_COMMENT]))
594 593
             $this->archive->setArchiveComment($options[PCLZIP_OPT_COMMENT]);
@@ -597,14 +596,14 @@  discard block
 block discarded – undo
597 596
                 ($comment = $this->archive->getArchiveComment() !== false)
598 597
                     ? $comment : null;
599 598
             $this->archive->setArchiveComment(
600
-                $comment . $options[PCLZIP_OPT_ADD_COMMENT]);
599
+                $comment.$options[PCLZIP_OPT_ADD_COMMENT]);
601 600
         }
602 601
         if (isset($options[PCLZIP_OPT_PREPEND_COMMENT])) {
603 602
             $comment =
604 603
                 ($comment = $this->archive->getArchiveComment() !== false)
605 604
                     ? $comment : null;
606 605
             $this->archive->setArchiveComment(
607
-                $options[PCLZIP_OPT_PREPEND_COMMENT] . $comment);
606
+                $options[PCLZIP_OPT_PREPEND_COMMENT].$comment);
608 607
         }
609 608
 
610 609
 
@@ -640,13 +639,13 @@  discard block
 block discarded – undo
640 639
         $report = array();
641 640
         $options = func_get_args();
642 641
         $options = array_combine(
643
-            array_filter($options, function ($v) {return (bool) $v&2;}),
644
-            array_filter($options, function ($v) {return (bool) ($v-1)&2;})
642
+            array_filter($options, function($v) {return (bool) $v & 2; }),
643
+            array_filter($options, function($v) {return (bool) ($v - 1) & 2; })
645 644
         );
646 645
 
647 646
         // exact matching
648 647
         if (isset($options[PCLZIP_OPT_BY_NAME]))
649
-            $selectFilter = function ($key, $value) use ($options) {
648
+            $selectFilter = function($key, $value) use ($options) {
650 649
                 $allowedNames = is_array($options[PCLZIP_OPT_BY_NAME])
651 650
                     ? $options[PCLZIP_OPT_BY_NAME]
652 651
                     : explode(',', $options[PCLZIP_OPT_BY_NAME]);
@@ -671,21 +670,21 @@  discard block
 block discarded – undo
671 670
             };
672 671
         // <ereg> rule
673 672
         else if (isset($options[PCLZIP_OPT_BY_EREG]) && function_exists('ereg'))
674
-            $selectFilter = function ($key, $value) use ($options) {
673
+            $selectFilter = function($key, $value) use ($options) {
675 674
                 return (ereg($options[PCLZIP_OPT_BY_EREG], $key) !== false)
676 675
                     ? self::SELECT_FILTER_PASS
677 676
                     : self::SELECT_FILTER_REFUSE;
678 677
             };
679 678
         // <preg_match> rule
680 679
         else if (isset($options[PCLZIP_OPT_BY_PREG]))
681
-            $selectFilter = function ($key, $value) use ($options) {
680
+            $selectFilter = function($key, $value) use ($options) {
682 681
                 return preg_match($options[PCLZIP_OPT_BY_PREG], $key)
683 682
                     ? self::SELECT_FILTER_PASS
684 683
                     : self::SELECT_FILTER_REFUSE;
685 684
             };
686 685
         // index rule
687 686
         else if (isset($options[PCLZIP_OPT_BY_INDEX]))
688
-            $selectFilter = function ($key, $value, $index) use ($options) {
687
+            $selectFilter = function($key, $value, $index) use ($options) {
689 688
                 $allowedIndexes = array();
690 689
                 foreach ($options[PCLZIP_OPT_BY_INDEX] as $rule) {
691 690
                     $parts = explode('-', $rule);
@@ -700,7 +699,7 @@  discard block
 block discarded – undo
700 699
             };
701 700
         // no rule
702 701
         else
703
-            $selectFilter = function () { return self::SELECT_FILTER_PASS; };
702
+            $selectFilter = function() { return self::SELECT_FILTER_PASS; };
704 703
 
705 704
         foreach ($this->listContent() as $file_header) {
706 705
             // select by select rule
@@ -780,7 +779,7 @@  discard block
 block discarded – undo
780 779
             }
781 780
         }
782 781
 
783
-        call_user_func(function ($directory) {
782
+        call_user_func(function($directory) {
784 783
             foreach (glob($directory.'/*') as $f) {
785 784
                 if (is_dir($f)) call_user_func(__FUNCTION__, $f);
786 785
                 else unlink($f);
Please login to merge, or discard this patch.
src/UnifiedArchive.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
     public static function open($fileName, $password = null)
56 56
     {
57 57
         if (!file_exists($fileName) || !is_readable($fileName)) {
58
-            throw new InvalidArgumentException('Could not open file: ' . $fileName);
58
+            throw new InvalidArgumentException('Could not open file: '.$fileName);
59 59
         }
60 60
 
61 61
         $format = Formats::detectArchiveFormat($fileName);
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
     public function getFileData($fileName)
215 215
     {
216 216
         if (!in_array($fileName, $this->files, true)) {
217
-            throw new NonExistentArchiveFileException('File ' . $fileName . ' does not exist in archive');
217
+            throw new NonExistentArchiveFileException('File '.$fileName.' does not exist in archive');
218 218
         }
219 219
 
220 220
         return $this->archive->getFileData($fileName);
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
     public function getFileContent($fileName)
231 231
     {
232 232
         if (!in_array($fileName, $this->files, true)) {
233
-            throw new NonExistentArchiveFileException('File ' . $fileName . ' does not exist in archive');
233
+            throw new NonExistentArchiveFileException('File '.$fileName.' does not exist in archive');
234 234
         }
235 235
 
236 236
         return $this->archive->getFileContent($fileName);
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
     public function getFileStream($fileName)
247 247
     {
248 248
         if (!in_array($fileName, $this->files, true)) {
249
-            throw new NonExistentArchiveFileException('File ' . $fileName . ' does not exist in archive');
249
+            throw new NonExistentArchiveFileException('File '.$fileName.' does not exist in archive');
250 250
         }
251 251
 
252 252
         return $this->archive->getFileStream($fileName);
@@ -501,7 +501,7 @@  discard block
 block discarded – undo
501 501
     public static function archiveFile($file, $archiveName, $compressionLevel = BasicDriver::COMPRESSION_AVERAGE)
502 502
     {
503 503
         if (!is_file($file)) {
504
-            throw new InvalidArgumentException($file . ' is not a valid file to archive');
504
+            throw new InvalidArgumentException($file.' is not a valid file to archive');
505 505
         }
506 506
 
507 507
         return static::archiveFiles($file, $archiveName, $compressionLevel) === 1;
Please login to merge, or discard this patch.
src/Formats/TarByPear.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
                 $compression = 'lzma2';
120 120
                 break;
121 121
             case 'z':
122
-                $tar_aname = 'compress.lzw://' . $archiveFileName;
122
+                $tar_aname = 'compress.lzw://'.$archiveFileName;
123 123
                 break;
124 124
         }
125 125
 
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 
172 172
             case Formats::TAR_LZW:
173 173
                 LzwStreamWrapper::registerWrapper();
174
-                $this->tar = new Archive_Tar('compress.lzw://' . $this->archiveFileName);
174
+                $this->tar = new Archive_Tar('compress.lzw://'.$this->archiveFileName);
175 175
                 break;
176 176
 
177 177
             default:
Please login to merge, or discard this patch.
src/Formats/Iso.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -120,11 +120,11 @@  discard block
 block discarded – undo
120 120
                     $this->files[$file->Location] = $directory.$file->strd_FileId;
121 121
                     $this->filesSize += $file->DataLen;
122 122
 
123
-                    $this->filesData[$directory . $file->strd_FileId] =
123
+                    $this->filesData[$directory.$file->strd_FileId] =
124 124
                         [
125 125
                             'size' => $file->DataLen,
126 126
                             'mtime' =>
127
-                                strtotime((string)$file->isoRecDate),
127
+                                strtotime((string) $file->isoRecDate),
128 128
                         ];
129 129
                 }
130 130
             }
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
             return false;
173 173
 
174 174
         return new ArchiveEntry($fileName, $this->filesData[$fileName]['size'],
175
-            $this->filesData[$fileName]['size'], $this->filesData[$fileName]['mtime'],false);
175
+            $this->filesData[$fileName]['size'], $this->filesData[$fileName]['mtime'], false);
176 176
     }
177 177
 
178 178
     /**
Please login to merge, or discard this patch.
src/Formats/SevenZip.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -139,8 +139,8 @@
 block discarded – undo
139 139
             $information->files[] = $can_get_unix_path
140 140
                 ? $entry->getUnixPath()
141 141
                 : str_replace('\\', '/', $entry->getPath());
142
-            $information->compressedFilesSize += (int)$entry->getPackedSize();
143
-            $information->uncompressedFilesSize += (int)$entry->getSize();
142
+            $information->compressedFilesSize += (int) $entry->getPackedSize();
143
+            $information->uncompressedFilesSize += (int) $entry->getSize();
144 144
         }
145 145
         return $information;
146 146
     }
Please login to merge, or discard this patch.
src/Formats/OneFile/Gzip.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
     {
16 16
         $fp = fopen($file, 'rb');
17 17
         if (filesize($file) < 18 || strcmp(fread($fp, 2), "\x1f\x8b")) {
18
-            return false;  // Not GZIP format (See RFC 1952)
18
+            return false; // Not GZIP format (See RFC 1952)
19 19
         }
20 20
         $method = fread($fp, 1);
21 21
         $flags = fread($fp, 1);
Please login to merge, or discard this patch.
src/Formats/OneFile/Lzma.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
  */
12 12
 class Lzma extends OneFileDriver
13 13
 {
14
-    const FORMAT_SUFFIX =  'xz';
14
+    const FORMAT_SUFFIX = 'xz';
15 15
 
16 16
     /**
17 17
      * @return array
Please login to merge, or discard this patch.
src/Formats/OneFile/Bzip.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@
 block discarded – undo
5 5
 
6 6
 class Bzip extends OneFileDriver
7 7
 {
8
-    const FORMAT_SUFFIX =  'bz2';
8
+    const FORMAT_SUFFIX = 'bz2';
9 9
 
10 10
     /**
11 11
      * @return array
Please login to merge, or discard this patch.
src/Formats/Zip.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@
 block discarded – undo
47 47
 
48 48
     public static function getDescription()
49 49
     {
50
-        return 'adapter for ext-zip'.(extension_loaded('zip') && defined('\ZipArchive::LIBZIP_VERSION') ? ' ('. ZipArchive::LIBZIP_VERSION.')' : null);
50
+        return 'adapter for ext-zip'.(extension_loaded('zip') && defined('\ZipArchive::LIBZIP_VERSION') ? ' ('.ZipArchive::LIBZIP_VERSION.')' : null);
51 51
     }
52 52
 
53 53
     public static function getInstallationInstruction()
Please login to merge, or discard this patch.