Passed
Branch feature/nextversion (70bb59)
by Alexey
01:57
created
src/IO/Filter/Cipher/WinZipAes/WinZipAesEncryptionStreamFilter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@
 block discarded – undo
60 60
             return false;
61 61
         }
62 62
 
63
-        $this->size = (int) $this->params['size'];
63
+        $this->size = (int)$this->params['size'];
64 64
         $this->context = null;
65 65
         $this->buffer = '';
66 66
 
Please login to merge, or discard this patch.
src/IO/Filter/Cipher/WinZipAes/WinZipAesContext.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
      */
56 56
     public function __construct($encryptionStrengthBits, $password, $salt)
57 57
     {
58
-        $encryptionStrengthBits = (int) $encryptionStrengthBits;
58
+        $encryptionStrengthBits = (int)$encryptionStrengthBits;
59 59
 
60 60
         if ($password === '') {
61 61
             throw new RuntimeException('$password is empty');
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
         $password = substr($password, 0, 99);
70 70
 
71 71
         $this->iv = str_repeat("\0", self::IV_SIZE);
72
-        $keyStrengthBytes = (int) ($encryptionStrengthBits / 8);
72
+        $keyStrengthBytes = (int)($encryptionStrengthBits / 8);
73 73
         $hashLength = $keyStrengthBytes * 2 + self::PASSWORD_VERIFIER_SIZE * 8;
74 74
 
75 75
         $hash = hash_pbkdf2(
Please login to merge, or discard this patch.
src/IO/Filter/Cipher/Traditional/PKEncryptionStreamFilter.php 1 patch
Spacing   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -61,14 +61,13 @@
 block discarded – undo
61 61
             return false;
62 62
         }
63 63
 
64
-        $this->size = (int) $this->params['size'];
64
+        $this->size = (int)$this->params['size'];
65 65
 
66 66
         // init keys
67 67
         $this->context = new PKCryptContext($password);
68 68
 
69 69
         $crc = $entry->isDataDescriptorRequired() ?
70
-            ($entry->getDosTime() & 0x0000ffff) << 16 :
71
-            $entry->getCrc();
70
+            ($entry->getDosTime() & 0x0000ffff) << 16 : $entry->getCrc();
72 71
 
73 72
         try {
74 73
             $headerBytes = random_bytes(PKCryptContext::STD_DEC_HDR_SIZE);
Please login to merge, or discard this patch.
src/IO/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/IO/Stream/ZipEntryStreamWrapper.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -255,7 +255,7 @@
 block discarded – undo
255 255
      */
256 256
     public function stream_truncate($new_size)
257 257
     {
258
-        return ftruncate($this->fp, (int) $new_size);
258
+        return ftruncate($this->fp, (int)$new_size);
259 259
     }
260 260
 
261 261
     /**
Please login to merge, or discard this patch.
src/IO/ZipWriter.php 1 patch
Spacing   +4 added lines, -5 removed lines patch added patch discarded remove patch
@@ -266,10 +266,9 @@  discard block
 block discarded – undo
266 266
      */
267 267
     protected function getExtraFieldsContents(ZipEntry $entry, $local)
268 268
     {
269
-        $local = (bool) $local;
269
+        $local = (bool)$local;
270 270
         $collection = $local ?
271
-            $entry->getLocalExtraFields() :
272
-            $entry->getCdExtraFields();
271
+            $entry->getLocalExtraFields() : $entry->getCdExtraFields();
273 272
         $extraData = '';
274 273
 
275 274
         foreach ($collection as $extraField) {
@@ -465,7 +464,7 @@  discard block
 block discarded – undo
465 464
             $offset += $read;
466 465
         }
467 466
 
468
-        return (int) hexdec(hash_final($contextHash));
467
+        return (int)hexdec(hash_final($contextHash));
469 468
     }
470 469
 
471 470
     /**
@@ -769,7 +768,7 @@  discard block
 block discarded – undo
769 768
             // find max software version, version needed to extract and most common platform
770 769
             list($softwareVersion, $versionNeededToExtract) = array_reduce(
771 770
                 $this->zipContainer->getEntries(),
772
-                static function (array $carry, ZipEntry $entry) {
771
+                static function(array $carry, ZipEntry $entry) {
773 772
                     $carry[0] = max($carry[0], $entry->getSoftwareVersion() & 0xFF);
774 773
                     $carry[1] = max($carry[1], $entry->getExtractVersion() & 0xFF);
775 774
 
Please login to merge, or discard this patch.
src/IO/ZipReader.php 1 patch
Spacing   +3 added lines, -5 removed lines patch added patch discarded remove patch
@@ -514,8 +514,7 @@  discard block
 block discarded – undo
514 514
     protected function parseExtraFields($buffer, ZipEntry $zipEntry, $local = false)
515 515
     {
516 516
         $collection = $local ?
517
-            $zipEntry->getLocalExtraFields() :
518
-            $zipEntry->getCdExtraFields();
517
+            $zipEntry->getLocalExtraFields() : $zipEntry->getCdExtraFields();
519 518
 
520 519
         if (!empty($buffer)) {
521 520
             $pos = 0;
@@ -538,8 +537,7 @@  discard block
 block discarded – undo
538 537
                 if ($className !== null) {
539 538
                     try {
540 539
                         $extraField = $local ?
541
-                            \call_user_func([$className, 'unpackLocalFileData'], $bufferData, $zipEntry) :
542
-                            \call_user_func([$className, 'unpackCentralDirData'], $bufferData, $zipEntry);
540
+                            \call_user_func([$className, 'unpackLocalFileData'], $bufferData, $zipEntry) : \call_user_func([$className, 'unpackCentralDirData'], $bufferData, $zipEntry);
543 541
                     } catch (\Throwable $e) {
544 542
                         throw new \RuntimeException(
545 543
                             sprintf(
@@ -838,7 +836,7 @@  discard block
 block discarded – undo
838 836
                     $offset += $length;
839 837
                 }
840 838
 
841
-                $expectedCrc = (int) hexdec(hash_final($contextHash));
839
+                $expectedCrc = (int)hexdec(hash_final($contextHash));
842 840
 
843 841
                 if ($expectedCrc !== $entry->getCrc()) {
844 842
                     throw new Crc32Exception($entry->getName(), $expectedCrc, $entry->getCrc());
Please login to merge, or discard this patch.
src/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
         );
@@ -73,9 +73,9 @@  discard block
 block discarded – undo
73 73
              * @param ZipEntry $entry
74 74
              * @param string   $entryName
75 75
              */
76
-            function (ZipEntry $entry, $entryName) use ($regexp) {
76
+            function(ZipEntry $entry, $entryName) use ($regexp) {
77 77
                 if (preg_match($regexp, $entryName)) {
78
-                    $this->matches[] = (string) $entryName;
78
+                    $this->matches[] = (string)$entryName;
79 79
                 }
80 80
             }
81 81
         );
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
             array_walk(
109 109
                 $this->matches,
110 110
                 /** @param string $entryName */
111
-                static function ($entryName) use ($callable) {
111
+                static function($entryName) use ($callable) {
112 112
                     $callable($entryName);
113 113
                 }
114 114
             );
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
         array_walk(
129 129
             $this->matches,
130 130
             /** @param string $entryName */
131
-            function ($entryName) {
131
+            function($entryName) {
132 132
                 $this->zipContainer->deleteEntry($entryName);
133 133
             }
134 134
         );
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
         array_walk(
145 145
             $this->matches,
146 146
             /** @param string $entryName */
147
-            function ($entryName) use ($password, $encryptionMethod) {
147
+            function($entryName) use ($password, $encryptionMethod) {
148 148
                 $entry = $this->zipContainer->getEntry($entryName);
149 149
 
150 150
                 if (!$entry->isDirectory()) {
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
         array_walk(
163 163
             $this->matches,
164 164
             /** @param string $entryName */
165
-            function ($entryName) use ($encryptionMethod) {
165
+            function($entryName) use ($encryptionMethod) {
166 166
                 $entry = $this->zipContainer->getEntry($entryName);
167 167
 
168 168
                 if (!$entry->isDirectory()) {
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
         array_walk(
178 178
             $this->matches,
179 179
             /** @param string $entryName */
180
-            function ($entryName) {
180
+            function($entryName) {
181 181
                 $entry = $this->zipContainer->getEntry($entryName);
182 182
 
183 183
                 if (!$entry->isDirectory()) {
Please login to merge, or discard this patch.
src/Model/ZipEntry.php 1 patch
Spacing   +37 added lines, -38 removed lines patch added patch discarded remove patch
@@ -206,19 +206,19 @@  discard block
 block discarded – undo
206 206
         $charset
207 207
     ) {
208 208
         $entry = new self($name);
209
-        $entry->createdOS = (int) $createdOS;
210
-        $entry->extractedOS = (int) $extractedOS;
211
-        $entry->softwareVersion = (int) $softwareVersion;
212
-        $entry->extractVersion = (int) $extractVersion;
213
-        $entry->compressionMethod = (int) $compressionMethod;
214
-        $entry->generalPurposeBitFlags = (int) $gpbf;
215
-        $entry->dosTime = (int) $dosTime;
216
-        $entry->crc = (int) $crc;
217
-        $entry->compressedSize = (int) $compressedSize;
218
-        $entry->uncompressedSize = (int) $uncompressedSize;
219
-        $entry->internalAttributes = (int) $internalAttributes;
220
-        $entry->externalAttributes = (int) $externalAttributes;
221
-        $entry->localHeaderOffset = (int) $offsetLocalHeader;
209
+        $entry->createdOS = (int)$createdOS;
210
+        $entry->extractedOS = (int)$extractedOS;
211
+        $entry->softwareVersion = (int)$softwareVersion;
212
+        $entry->extractVersion = (int)$extractVersion;
213
+        $entry->compressionMethod = (int)$compressionMethod;
214
+        $entry->generalPurposeBitFlags = (int)$gpbf;
215
+        $entry->dosTime = (int)$dosTime;
216
+        $entry->crc = (int)$crc;
217
+        $entry->compressedSize = (int)$compressedSize;
218
+        $entry->uncompressedSize = (int)$uncompressedSize;
219
+        $entry->internalAttributes = (int)$internalAttributes;
220
+        $entry->externalAttributes = (int)$externalAttributes;
221
+        $entry->localHeaderOffset = (int)$offsetLocalHeader;
222 222
         $entry->setComment($comment);
223 223
         $entry->setCharset($charset);
224 224
         $entry->updateCompressionLevel();
@@ -239,13 +239,13 @@  discard block
 block discarded – undo
239 239
             throw new InvalidArgumentException('zip entry name is null');
240 240
         }
241 241
 
242
-        $name = ltrim((string) $name, '\\/');
242
+        $name = ltrim((string)$name, '\\/');
243 243
 
244 244
         if ($name === '') {
245 245
             throw new InvalidArgumentException('Empty zip entry name');
246 246
         }
247 247
 
248
-        $name = (string) $name;
248
+        $name = (string)$name;
249 249
         $length = \strlen($name);
250 250
 
251 251
         if ($length > 0xffff) {
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
      */
372 372
     public function setCreatedOS($platform)
373 373
     {
374
-        $platform = (int) $platform;
374
+        $platform = (int)$platform;
375 375
 
376 376
         if ($platform < 0x00 || $platform > 0xff) {
377 377
             throw new InvalidArgumentException('Platform out of range');
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
      */
399 399
     public function setExtractedOS($platform)
400 400
     {
401
-        $platform = (int) $platform;
401
+        $platform = (int)$platform;
402 402
 
403 403
         if ($platform < 0x00 || $platform > 0xff) {
404 404
             throw new InvalidArgumentException('Platform out of range');
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
      */
428 428
     public function setSoftwareVersion($softwareVersion)
429 429
     {
430
-        $this->softwareVersion = (int) $softwareVersion;
430
+        $this->softwareVersion = (int)$softwareVersion;
431 431
 
432 432
         return $this;
433 433
     }
@@ -467,8 +467,7 @@  discard block
 block discarded – undo
467 467
             }
468 468
 
469 469
             return $this->getCompressionMethod() === ZipCompressionMethod::DEFLATED || $this->isDirectory() ?
470
-                ZipVersion::v20_DEFLATED_FOLDER_ZIPCRYPTO :
471
-                ZipVersion::v10_DEFAULT_MIN;
470
+                ZipVersion::v20_DEFLATED_FOLDER_ZIPCRYPTO : ZipVersion::v10_DEFAULT_MIN;
472 471
         }
473 472
 
474 473
         return $this->extractVersion;
@@ -499,7 +498,7 @@  discard block
 block discarded – undo
499 498
      */
500 499
     public function setExtractVersion($version)
501 500
     {
502
-        $this->extractVersion = max(ZipVersion::v10_DEFAULT_MIN, (int) $version);
501
+        $this->extractVersion = max(ZipVersion::v10_DEFAULT_MIN, (int)$version);
503 502
 
504 503
         return $this;
505 504
     }
@@ -599,7 +598,7 @@  discard block
 block discarded – undo
599 598
      */
600 599
     public function setLocalHeaderOffset($localHeaderOffset)
601 600
     {
602
-        $this->localHeaderOffset = (int) $localHeaderOffset;
601
+        $this->localHeaderOffset = (int)$localHeaderOffset;
603 602
 
604 603
         return $this;
605 604
     }
@@ -728,7 +727,7 @@  discard block
 block discarded – undo
728 727
      */
729 728
     public function enableDataDescriptor($enabled = true)
730 729
     {
731
-        $this->setGeneralBitFlag(GeneralPurposeBitFlag::DATA_DESCRIPTOR, (bool) $enabled);
730
+        $this->setGeneralBitFlag(GeneralPurposeBitFlag::DATA_DESCRIPTOR, (bool)$enabled);
732 731
     }
733 732
 
734 733
     /**
@@ -736,7 +735,7 @@  discard block
 block discarded – undo
736 735
      */
737 736
     public function enableUtf8Name($enabled)
738 737
     {
739
-        $this->setGeneralBitFlag(GeneralPurposeBitFlag::UTF8, (bool) $enabled);
738
+        $this->setGeneralBitFlag(GeneralPurposeBitFlag::UTF8, (bool)$enabled);
740 739
     }
741 740
 
742 741
     /**
@@ -789,7 +788,7 @@  discard block
 block discarded – undo
789 788
      */
790 789
     private function setEncrypted($encrypted)
791 790
     {
792
-        $encrypted = (bool) $encrypted;
791
+        $encrypted = (bool)$encrypted;
793 792
         $this->setGeneralBitFlag(GeneralPurposeBitFlag::ENCRYPTION, $encrypted);
794 793
 
795 794
         return $this;
@@ -903,7 +902,7 @@  discard block
 block discarded – undo
903 902
      */
904 903
     public function setDosTime($dosTime)
905 904
     {
906
-        $dosTime = (int) $dosTime;
905
+        $dosTime = (int)$dosTime;
907 906
 
908 907
         if ($dosTime < 0x00000000 || $dosTime > 0xffffffff) {
909 908
             throw new InvalidArgumentException('DosTime out of range');
@@ -952,7 +951,7 @@  discard block
 block discarded – undo
952 951
      */
953 952
     public function setExternalAttributes($externalAttributes)
954 953
     {
955
-        $this->externalAttributes = (int) $externalAttributes;
954
+        $this->externalAttributes = (int)$externalAttributes;
956 955
 
957 956
         return $this;
958 957
     }
@@ -976,7 +975,7 @@  discard block
 block discarded – undo
976 975
      */
977 976
     public function setInternalAttributes($attributes)
978 977
     {
979
-        $this->internalAttributes = (int) $attributes;
978
+        $this->internalAttributes = (int)$attributes;
980 979
 
981 980
         return $this;
982 981
     }
@@ -1007,7 +1006,7 @@  discard block
 block discarded – undo
1007 1006
      */
1008 1007
     public function getCdExtraField($headerId)
1009 1008
     {
1010
-        return $this->cdExtraFields->get((int) $headerId);
1009
+        return $this->cdExtraFields->get((int)$headerId);
1011 1010
     }
1012 1011
 
1013 1012
     /**
@@ -1037,7 +1036,7 @@  discard block
 block discarded – undo
1037 1036
      */
1038 1037
     public function getLocalExtraField($headerId)
1039 1038
     {
1040
-        return $this->localExtraFields[(int) $headerId];
1039
+        return $this->localExtraFields[(int)$headerId];
1041 1040
     }
1042 1041
 
1043 1042
     /**
@@ -1059,7 +1058,7 @@  discard block
 block discarded – undo
1059 1058
      */
1060 1059
     public function getExtraField($headerId)
1061 1060
     {
1062
-        $headerId = (int) $headerId;
1061
+        $headerId = (int)$headerId;
1063 1062
         $local = $this->getLocalExtraField($headerId);
1064 1063
 
1065 1064
         if ($local === null) {
@@ -1076,7 +1075,7 @@  discard block
 block discarded – undo
1076 1075
      */
1077 1076
     public function hasExtraField($headerId)
1078 1077
     {
1079
-        $headerId = (int) $headerId;
1078
+        $headerId = (int)$headerId;
1080 1079
 
1081 1080
         return
1082 1081
             isset($this->localExtraFields[$headerId]) ||
@@ -1088,7 +1087,7 @@  discard block
 block discarded – undo
1088 1087
      */
1089 1088
     public function removeExtraField($headerId)
1090 1089
     {
1091
-        $headerId = (int) $headerId;
1090
+        $headerId = (int)$headerId;
1092 1091
 
1093 1092
         $this->cdExtraFields->remove($headerId);
1094 1093
         $this->localExtraFields->remove($headerId);
@@ -1156,7 +1155,7 @@  discard block
 block discarded – undo
1156 1155
      */
1157 1156
     public function setCrc($crc)
1158 1157
     {
1159
-        $this->crc = (int) $crc;
1158
+        $this->crc = (int)$crc;
1160 1159
 
1161 1160
         return $this;
1162 1161
     }
@@ -1188,7 +1187,7 @@  discard block
 block discarded – undo
1188 1187
                 $this->password = null;
1189 1188
                 $this->disableEncryption();
1190 1189
             } else {
1191
-                $this->password = (string) $password;
1190
+                $this->password = (string)$password;
1192 1191
                 $this->setEncrypted(true);
1193 1192
             }
1194 1193
         }
@@ -1223,7 +1222,7 @@  discard block
 block discarded – undo
1223 1222
             $encryptionMethod = ZipEncryptionMethod::NONE;
1224 1223
         }
1225 1224
 
1226
-        $encryptionMethod = (int) $encryptionMethod;
1225
+        $encryptionMethod = (int)$encryptionMethod;
1227 1226
         ZipEncryptionMethod::checkSupport($encryptionMethod);
1228 1227
         $this->encryptionMethod = $encryptionMethod;
1229 1228
 
@@ -1247,7 +1246,7 @@  discard block
 block discarded – undo
1247 1246
      */
1248 1247
     public function setCompressionLevel($compressionLevel)
1249 1248
     {
1250
-        $compressionLevel = (int) $compressionLevel;
1249
+        $compressionLevel = (int)$compressionLevel;
1251 1250
 
1252 1251
         if ($compressionLevel === self::UNKNOWN) {
1253 1252
             $compressionLevel = ZipCompressionLevel::NORMAL;
@@ -1309,7 +1308,7 @@  discard block
 block discarded – undo
1309 1308
      */
1310 1309
     public function setUnixMode($mode)
1311 1310
     {
1312
-        $mode = (int) $mode;
1311
+        $mode = (int)$mode;
1313 1312
         $this->setExternalAttributes(
1314 1313
             ($mode << 16)
1315 1314
             // MS-DOS read-only attribute
Please login to merge, or discard this patch.