Passed
Push — master ( ca068f...f2d295 )
by Alexey
03:12 queued 16s
created
src/PhpZip/Util/DateTimeConverter.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -39,11 +39,11 @@
 block discarded – undo
39 39
         }
40 40
 
41 41
         return mktime(
42
-            ($dosTime >> 11) & 0x1f,         // hour
43
-            ($dosTime >> 5) & 0x3f,        // minute
44
-            2 * ($dosTime & 0x1f),         // second
45
-            ($dosTime >> 21) & 0x0f,       // month
46
-            ($dosTime >> 16) & 0x1f,         // day
42
+            ($dosTime >> 11) & 0x1f, // hour
43
+            ($dosTime >> 5) & 0x3f, // minute
44
+            2 * ($dosTime & 0x1f), // second
45
+            ($dosTime >> 21) & 0x0f, // month
46
+            ($dosTime >> 16) & 0x1f, // day
47 47
             1980 + (($dosTime >> 25) & 0x7f) // year
48 48
         );
49 49
     }
Please login to merge, or discard this patch.
src/PhpZip/Extra/Fields/WinZipAesEntryExtraField.php 1 patch
Spacing   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -159,8 +159,7 @@  discard block
 block discarded – undo
159 159
     public function getEncryptionMethod()
160 160
     {
161 161
         return isset(self::$encryptionMethods[$this->getKeyStrength()]) ?
162
-            self::$encryptionMethods[$this->getKeyStrength()] :
163
-            self::$encryptionMethods[self::KEY_STRENGTH_256BIT];
162
+            self::$encryptionMethods[$this->getKeyStrength()] : self::$encryptionMethods[self::KEY_STRENGTH_256BIT];
164 163
     }
165 164
 
166 165
     /**
@@ -210,8 +209,7 @@  discard block
 block discarded – undo
210 209
     public static function encryptionStrength($keyStrength)
211 210
     {
212 211
         return isset(self::$keyStrengths[$keyStrength]) ?
213
-            self::$keyStrengths[$keyStrength] :
214
-            self::$keyStrengths[self::KEY_STRENGTH_128BIT];
212
+            self::$keyStrengths[$keyStrength] : self::$keyStrengths[self::KEY_STRENGTH_128BIT];
215 213
     }
216 214
 
217 215
     /**
Please login to merge, or discard this patch.
src/PhpZip/Crypto/WinZipAesEngine.php 1 patch
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -174,8 +174,7 @@
 block discarded – undo
174 174
             }
175 175
             $data = substr($str, $i * 16, 16);
176 176
             $ctrStr .= $encrypted ?
177
-                self::encryptCtr($data, $key, $iv) :
178
-                self::decryptCtr($data, $key, $iv);
177
+                self::encryptCtr($data, $key, $iv) : self::decryptCtr($data, $key, $iv);
179 178
         }
180 179
 
181 180
         return $ctrStr;
Please login to merge, or discard this patch.
src/PhpZip/Crypto/TraditionalPkwareEncryptionEngine.php 1 patch
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -427,8 +427,7 @@
 block discarded – undo
427 427
         }
428 428
 
429 429
         $crc = $this->entry->isDataDescriptorRequired() ?
430
-            ($this->entry->getDosTime() & 0x0000ffff) << 16 :
431
-            $this->entry->getCrc();
430
+            ($this->entry->getDosTime() & 0x0000ffff) << 16 : $this->entry->getCrc();
432 431
 
433 432
         try {
434 433
             $headerBytes = random_bytes(self::STD_DEC_HDR_SIZE);
Please login to merge, or discard this patch.
src/PhpZip/ZipFile.php 1 patch
Spacing   +25 added lines, -26 removed lines patch added patch discarded remove patch
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
 
337 337
         if (!empty($entries)) {
338 338
             if (\is_string($entries)) {
339
-                $entries = (array) $entries;
339
+                $entries = (array)$entries;
340 340
             }
341 341
 
342 342
             if (\is_array($entries)) {
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
                 $flipEntries = array_flip($entries);
345 345
                 $zipEntries = array_filter(
346 346
                     $zipEntries,
347
-                    static function (ZipEntry $zipEntry) use ($flipEntries) {
347
+                    static function(ZipEntry $zipEntry) use ($flipEntries) {
348 348
                         return isset($flipEntries[$zipEntry->getName()]);
349 349
                     }
350 350
                 );
@@ -411,12 +411,12 @@  discard block
 block discarded – undo
411 411
         if ($localName === null) {
412 412
             throw new InvalidArgumentException('Entry name is null');
413 413
         }
414
-        $localName = ltrim((string) $localName, '\\/');
414
+        $localName = ltrim((string)$localName, '\\/');
415 415
 
416 416
         if ($localName === '') {
417 417
             throw new InvalidArgumentException('Empty entry name');
418 418
         }
419
-        $contents = (string) $contents;
419
+        $contents = (string)$contents;
420 420
         $length = \strlen($contents);
421 421
 
422 422
         if ($compressionMethod === null) {
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
         if ($localName === null) {
488 488
             $localName = basename($filename);
489 489
         }
490
-        $localName = ltrim((string) $localName, '\\/');
490
+        $localName = ltrim((string)$localName, '\\/');
491 491
 
492 492
         if ($localName === '') {
493 493
             throw new InvalidArgumentException('Empty entry name');
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
         if ($localName === null) {
534 534
             throw new InvalidArgumentException('Entry name is null');
535 535
         }
536
-        $localName = ltrim((string) $localName, '\\/');
536
+        $localName = ltrim((string)$localName, '\\/');
537 537
 
538 538
         if ($localName === '') {
539 539
             throw new InvalidArgumentException('Empty entry name');
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
         if ($dirName === null) {
587 587
             throw new InvalidArgumentException('Dir name is null');
588 588
         }
589
-        $dirName = ltrim((string) $dirName, '\\/');
589
+        $dirName = ltrim((string)$dirName, '\\/');
590 590
 
591 591
         if ($dirName === '') {
592 592
             throw new InvalidArgumentException('Empty dir name');
@@ -626,7 +626,7 @@  discard block
 block discarded – undo
626 626
         if ($inputDir === null) {
627 627
             throw new InvalidArgumentException('Input dir is null');
628 628
         }
629
-        $inputDir = (string) $inputDir;
629
+        $inputDir = (string)$inputDir;
630 630
 
631 631
         if ($inputDir === '') {
632 632
             throw new InvalidArgumentException('The input directory is not specified');
@@ -664,7 +664,7 @@  discard block
 block discarded – undo
664 664
         if ($inputDir === null) {
665 665
             throw new InvalidArgumentException('Input dir is null');
666 666
         }
667
-        $inputDir = (string) $inputDir;
667
+        $inputDir = (string)$inputDir;
668 668
 
669 669
         if ($inputDir === '') {
670 670
             throw new InvalidArgumentException('The input directory is not specified');
@@ -702,7 +702,7 @@  discard block
 block discarded – undo
702 702
         $localPath = '/',
703 703
         $compressionMethod = null
704 704
     ) {
705
-        $localPath = (string) $localPath;
705
+        $localPath = (string)$localPath;
706 706
 
707 707
         if ($localPath !== '') {
708 708
             $localPath = trim($localPath, '\\/');
@@ -711,8 +711,7 @@  discard block
 block discarded – undo
711 711
         }
712 712
 
713 713
         $iterator = $iterator instanceof \RecursiveIterator ?
714
-            new \RecursiveIteratorIterator($iterator) :
715
-            new \IteratorIterator($iterator);
714
+            new \RecursiveIteratorIterator($iterator) : new \IteratorIterator($iterator);
716 715
         /**
717 716
          * @var string[] $files
718 717
          * @var string   $path
@@ -791,7 +790,7 @@  discard block
 block discarded – undo
791 790
         if ($inputDir === null) {
792 791
             throw new InvalidArgumentException('Input dir is null');
793 792
         }
794
-        $inputDir = (string) $inputDir;
793
+        $inputDir = (string)$inputDir;
795 794
 
796 795
         if ($inputDir === '') {
797 796
             throw new InvalidArgumentException('The input directory is not specified');
@@ -800,7 +799,7 @@  discard block
 block discarded – undo
800 799
         if (!is_dir($inputDir)) {
801 800
             throw new InvalidArgumentException(sprintf('The "%s" directory does not exist.', $inputDir));
802 801
         }
803
-        $globPattern = (string) $globPattern;
802
+        $globPattern = (string)$globPattern;
804 803
 
805 804
         if (empty($globPattern)) {
806 805
             throw new InvalidArgumentException('The glob pattern is not specified');
@@ -883,12 +882,12 @@  discard block
 block discarded – undo
883 882
         $recursive = true,
884 883
         $compressionMethod = null
885 884
     ) {
886
-        $regexPattern = (string) $regexPattern;
885
+        $regexPattern = (string)$regexPattern;
887 886
 
888 887
         if (empty($regexPattern)) {
889 888
             throw new InvalidArgumentException('The regex pattern is not specified');
890 889
         }
891
-        $inputDir = (string) $inputDir;
890
+        $inputDir = (string)$inputDir;
892 891
 
893 892
         if ($inputDir === '') {
894 893
             throw new InvalidArgumentException('The input directory is not specified');
@@ -993,8 +992,8 @@  discard block
 block discarded – undo
993 992
         if ($oldName === null || $newName === null) {
994 993
             throw new InvalidArgumentException('name is null');
995 994
         }
996
-        $oldName = ltrim((string) $oldName, '\\/');
997
-        $newName = ltrim((string) $newName, '\\/');
995
+        $oldName = ltrim((string)$oldName, '\\/');
996
+        $newName = ltrim((string)$newName, '\\/');
998 997
 
999 998
         if ($oldName !== $newName) {
1000 999
             $this->zipModel->renameEntry($oldName, $newName);
@@ -1014,7 +1013,7 @@  discard block
 block discarded – undo
1014 1013
      */
1015 1014
     public function deleteFromName($entryName)
1016 1015
     {
1017
-        $entryName = ltrim((string) $entryName, '\\/');
1016
+        $entryName = ltrim((string)$entryName, '\\/');
1018 1017
 
1019 1018
         if (!$this->zipModel->deleteEntry($entryName)) {
1020 1019
             throw new ZipEntryNotFoundException($entryName);
@@ -1094,7 +1093,7 @@  discard block
 block discarded – undo
1094 1093
             );
1095 1094
         }
1096 1095
         $this->matcher()->all()->invoke(
1097
-            function ($entry) use ($compressionLevel) {
1096
+            function($entry) use ($compressionLevel) {
1098 1097
                 $this->setCompressionLevelEntry($entry, $compressionLevel);
1099 1098
             }
1100 1099
         );
@@ -1380,7 +1379,7 @@  discard block
 block discarded – undo
1380 1379
      */
1381 1380
     public function saveAsFile($filename)
1382 1381
     {
1383
-        $filename = (string) $filename;
1382
+        $filename = (string)$filename;
1384 1383
 
1385 1384
         $tempFilename = $filename . '.temp' . uniqid('', true);
1386 1385
 
@@ -1435,7 +1434,7 @@  discard block
 block discarded – undo
1435 1434
      */
1436 1435
     public function outputAsAttachment($outputFilename, $mimeType = null, $attachment = true)
1437 1436
     {
1438
-        $outputFilename = (string) $outputFilename;
1437
+        $outputFilename = (string)$outputFilename;
1439 1438
 
1440 1439
         if ($mimeType === null) {
1441 1440
             $mimeType = $this->getMimeTypeByFilename($outputFilename);
@@ -1475,7 +1474,7 @@  discard block
 block discarded – undo
1475 1474
      */
1476 1475
     protected function getMimeTypeByFilename($outputFilename)
1477 1476
     {
1478
-        $outputFilename = (string) $outputFilename;
1477
+        $outputFilename = (string)$outputFilename;
1479 1478
         $ext = strtolower(pathinfo($outputFilename, \PATHINFO_EXTENSION));
1480 1479
 
1481 1480
         if (!empty($ext) && isset(self::$defaultMimeTypes[$ext])) {
@@ -1499,7 +1498,7 @@  discard block
 block discarded – undo
1499 1498
      */
1500 1499
     public function outputAsResponse(ResponseInterface $response, $outputFilename, $mimeType = null, $attachment = true)
1501 1500
     {
1502
-        $outputFilename = (string) $outputFilename;
1501
+        $outputFilename = (string)$outputFilename;
1503 1502
 
1504 1503
         if ($mimeType === null) {
1505 1504
             $mimeType = $this->getMimeTypeByFilename($outputFilename);
@@ -1646,7 +1645,7 @@  discard block
 block discarded – undo
1646 1645
         if ($entryName === null) {
1647 1646
             throw new InvalidArgumentException('entryName is null');
1648 1647
         }
1649
-        $entryName = ltrim((string) $entryName, '\\/');
1648
+        $entryName = ltrim((string)$entryName, '\\/');
1650 1649
 
1651 1650
         if ($entryName === '') {
1652 1651
             throw new InvalidArgumentException('entryName is empty');
@@ -1668,7 +1667,7 @@  discard block
 block discarded – undo
1668 1667
         } elseif (\is_resource($contents)) {
1669 1668
             $this->addFromStream($contents, $entryName);
1670 1669
         } else {
1671
-            $this->addFromString($entryName, (string) $contents);
1670
+            $this->addFromString($entryName, (string)$contents);
1672 1671
         }
1673 1672
     }
1674 1673
 
Please login to merge, or discard this patch.
src/PhpZip/Stream/ResponseStream.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -132,7 +132,7 @@
 block discarded – undo
132 132
         }
133 133
         $this->rewind();
134 134
 
135
-        return (string) stream_get_contents($this->stream);
135
+        return (string)stream_get_contents($this->stream);
136 136
     }
137 137
 
138 138
     /**
Please login to merge, or discard this patch.
src/PhpZip/Stream/ZipOutputStream.php 1 patch
Spacing   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -278,8 +278,7 @@  discard block
 block discarded – undo
278 278
 
279 279
                     case ZipFile::METHOD_BZIP2:
280 280
                         $compressionLevel = $entry->getCompressionLevel() === ZipFile::LEVEL_DEFAULT_COMPRESSION ?
281
-                            ZipEntry::LEVEL_DEFAULT_BZIP2_COMPRESSION :
282
-                            $entry->getCompressionLevel();
281
+                            ZipEntry::LEVEL_DEFAULT_BZIP2_COMPRESSION : $entry->getCompressionLevel();
283 282
                         /** @noinspection PhpComposerExtensionStubsInspection */
284 283
                         $entryContent = bzcompress($entryContent, $compressionLevel);
285 284
 
@@ -488,7 +487,7 @@  discard block
 block discarded – undo
488 487
             // find max software version, version needed to extract and most common platform
489 488
             list($softwareVersion, $versionNeededToExtract) = array_reduce(
490 489
                 $this->zipModel->getEntries(),
491
-                static function (array $carry, ZipEntry $entry) {
490
+                static function(array $carry, ZipEntry $entry) {
492 491
                     $carry[0] = max($carry[0], $entry->getSoftwareVersion() & 0xFF);
493 492
                     $carry[1] = max($carry[1], $entry->getVersionNeededToExtract() & 0xFF);
494 493
 
Please login to merge, or discard this patch.
src/PhpZip/Model/ZipEntryMatcher.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -31,10 +31,10 @@  discard block
 block discarded – undo
31 31
      */
32 32
     public function add($entries)
33 33
     {
34
-        $entries = (array) $entries;
34
+        $entries = (array)$entries;
35 35
         $entries = array_map(
36
-            static function ($entry) {
37
-                return $entry instanceof ZipEntry ? $entry->getName() : (string) $entry;
36
+            static function($entry) {
37
+                return $entry instanceof ZipEntry ? $entry->getName() : (string)$entry;
38 38
             },
39 39
             $entries
40 40
         );
@@ -67,13 +67,13 @@  discard block
 block discarded – undo
67 67
     {
68 68
         array_walk(
69 69
             $this->zipModel->getEntries(),
70
-            function (
70
+            function(
71 71
                 /** @noinspection PhpUnusedParameterInspection */
72 72
                 $entry,
73 73
                 $entryName
74 74
             ) use ($regexp) {
75 75
                 if (preg_match($regexp, $entryName)) {
76
-                    $this->matches[] = (string) $entryName;
76
+                    $this->matches[] = (string)$entryName;
77 77
                 }
78 78
             }
79 79
         );
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
         if (!empty($this->matches)) {
106 106
             array_walk(
107 107
                 $this->matches,
108
-                static function ($entryName) use ($callable) {
108
+                static function($entryName) use ($callable) {
109 109
                     $callable($entryName);
110 110
                 }
111 111
             );
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
     {
125 125
         array_walk(
126 126
             $this->matches,
127
-            function ($entry) {
127
+            function($entry) {
128 128
                 $this->zipModel->deleteEntry($entry);
129 129
             }
130 130
         );
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
     {
140 140
         array_walk(
141 141
             $this->matches,
142
-            function ($entry) use ($password, $encryptionMethod) {
142
+            function($entry) use ($password, $encryptionMethod) {
143 143
                 $entry = $this->zipModel->getEntry($entry);
144 144
 
145 145
                 if (!$entry->isDirectory()) {
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
     {
157 157
         array_walk(
158 158
             $this->matches,
159
-            function ($entry) use ($encryptionMethod) {
159
+            function($entry) use ($encryptionMethod) {
160 160
                 $entry = $this->zipModel->getEntry($entry);
161 161
 
162 162
                 if (!$entry->isDirectory()) {
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
     {
171 171
         array_walk(
172 172
             $this->matches,
173
-            function ($entry) {
173
+            function($entry) {
174 174
                 $entry = $this->zipModel->getEntry($entry);
175 175
 
176 176
                 if (!$entry->isDirectory()) {
Please login to merge, or discard this patch.
src/PhpZip/Model/ZipModel.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
     public function setArchiveComment($comment)
74 74
     {
75 75
         if ($comment !== null && $comment !== '') {
76
-            $comment = (string) $comment;
76
+            $comment = (string)$comment;
77 77
             $length = \strlen($comment);
78 78
 
79 79
             if ($length > 0xffff) {
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
      */
137 137
     public function setZipAlign($zipAlign)
138 138
     {
139
-        $this->zipAlign = $zipAlign === null ? null : (int) $zipAlign;
139
+        $this->zipAlign = $zipAlign === null ? null : (int)$zipAlign;
140 140
     }
141 141
 
142 142
     /**
@@ -187,8 +187,8 @@  discard block
 block discarded – undo
187 187
      */
188 188
     public function renameEntry($old, $new)
189 189
     {
190
-        $old = $old instanceof ZipEntry ? $old->getName() : (string) $old;
191
-        $new = $new instanceof ZipEntry ? $new->getName() : (string) $new;
190
+        $old = $old instanceof ZipEntry ? $old->getName() : (string)$old;
191
+        $new = $new instanceof ZipEntry ? $new->getName() : (string)$new;
192 192
 
193 193
         if (isset($this->outEntries[$new])) {
194 194
             throw new InvalidArgumentException('New entry name ' . $new . ' is exists.');
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
      */
230 230
     public function getEntry($entryName)
231 231
     {
232
-        $entryName = $entryName instanceof ZipEntry ? $entryName->getName() : (string) $entryName;
232
+        $entryName = $entryName instanceof ZipEntry ? $entryName->getName() : (string)$entryName;
233 233
 
234 234
         if (isset($this->outEntries[$entryName])) {
235 235
             return $this->outEntries[$entryName];
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
      */
246 246
     public function deleteEntry($entry)
247 247
     {
248
-        $entry = $entry instanceof ZipEntry ? $entry->getName() : (string) $entry;
248
+        $entry = $entry instanceof ZipEntry ? $entry->getName() : (string)$entry;
249 249
 
250 250
         if (isset($this->outEntries[$entry])) {
251 251
             unset($this->outEntries[$entry]);
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
      */
282 282
     public function hasEntry($entryName)
283 283
     {
284
-        $entryName = $entryName instanceof ZipEntry ? $entryName->getName() : (string) $entryName;
284
+        $entryName = $entryName instanceof ZipEntry ? $entryName->getName() : (string)$entryName;
285 285
 
286 286
         return isset($this->outEntries[$entryName]);
287 287
     }
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
      */
339 339
     public function unchangeEntry($entry)
340 340
     {
341
-        $entry = $entry instanceof ZipEntry ? $entry->getName() : (string) $entry;
341
+        $entry = $entry instanceof ZipEntry ? $entry->getName() : (string)$entry;
342 342
 
343 343
         if (isset($this->outEntries[$entry], $this->inputEntries[$entry])) {
344 344
             $this->outEntries[$entry] = $this->inputEntries[$entry];
Please login to merge, or discard this patch.