@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | |
392 | 392 | if (!empty($entries)) { |
393 | 393 | if (\is_string($entries)) { |
394 | - $entries = (array) $entries; |
|
394 | + $entries = (array)$entries; |
|
395 | 395 | } |
396 | 396 | |
397 | 397 | if (\is_array($entries)) { |
@@ -545,12 +545,12 @@ discard block |
||
545 | 545 | throw new InvalidArgumentException('Contents is null'); |
546 | 546 | } |
547 | 547 | |
548 | - $entryName = ltrim((string) $entryName, '\\/'); |
|
548 | + $entryName = ltrim((string)$entryName, '\\/'); |
|
549 | 549 | |
550 | 550 | if ($entryName === '') { |
551 | 551 | throw new InvalidArgumentException('Empty entry name'); |
552 | 552 | } |
553 | - $contents = (string) $contents; |
|
553 | + $contents = (string)$contents; |
|
554 | 554 | $length = \strlen($contents); |
555 | 555 | |
556 | 556 | if ($compressionMethod === null || $compressionMethod === ZipEntry::UNKNOWN) { |
@@ -559,8 +559,7 @@ discard block |
||
559 | 559 | } else { |
560 | 560 | $mimeType = FilesUtil::getMimeTypeFromString($contents); |
561 | 561 | $compressionMethod = FilesUtil::isBadCompressionMimeType($mimeType) ? |
562 | - ZipCompressionMethod::STORED : |
|
563 | - ZipCompressionMethod::DEFLATED; |
|
562 | + ZipCompressionMethod::STORED : ZipCompressionMethod::DEFLATED; |
|
564 | 563 | } |
565 | 564 | } |
566 | 565 | |
@@ -643,7 +642,7 @@ discard block |
||
643 | 642 | } |
644 | 643 | } |
645 | 644 | |
646 | - $entryName = ltrim((string) $entryName, '\\/'); |
|
645 | + $entryName = ltrim((string)$entryName, '\\/'); |
|
647 | 646 | |
648 | 647 | if ($entryName === '') { |
649 | 648 | throw new InvalidArgumentException('Empty entry name'); |
@@ -661,8 +660,7 @@ discard block |
||
661 | 660 | $compressionMethod = ZipCompressionMethod::STORED; |
662 | 661 | } else { |
663 | 662 | $compressionMethod = FilesUtil::isBadCompressionFile($file->getPathname()) ? |
664 | - ZipCompressionMethod::STORED : |
|
665 | - ZipCompressionMethod::DEFLATED; |
|
663 | + ZipCompressionMethod::STORED : ZipCompressionMethod::DEFLATED; |
|
666 | 664 | } |
667 | 665 | |
668 | 666 | $zipEntry->setUncompressedSize($file->getSize()); |
@@ -698,7 +696,7 @@ discard block |
||
698 | 696 | if ($mtime instanceof \DateTimeInterface) { |
699 | 697 | $timestamp = $mtime->getTimestamp(); |
700 | 698 | } elseif (is_numeric($mtime)) { |
701 | - $timestamp = (int) $mtime; |
|
699 | + $timestamp = (int)$mtime; |
|
702 | 700 | } elseif (\is_string($mtime)) { |
703 | 701 | $timestamp = strtotime($mtime); |
704 | 702 | |
@@ -784,7 +782,7 @@ discard block |
||
784 | 782 | if ($entryName === null) { |
785 | 783 | throw new InvalidArgumentException('Entry name is null'); |
786 | 784 | } |
787 | - $entryName = ltrim((string) $entryName, '\\/'); |
|
785 | + $entryName = ltrim((string)$entryName, '\\/'); |
|
788 | 786 | |
789 | 787 | if ($entryName === '') { |
790 | 788 | throw new InvalidArgumentException('Empty entry name'); |
@@ -794,7 +792,7 @@ discard block |
||
794 | 792 | $zipEntry = new ZipEntry($entryName); |
795 | 793 | |
796 | 794 | if ($fstat !== false) { |
797 | - $unixMode = (int) sprintf('%o', $fstat['mode']); |
|
795 | + $unixMode = (int)sprintf('%o', $fstat['mode']); |
|
798 | 796 | $length = $fstat['size']; |
799 | 797 | |
800 | 798 | if ($compressionMethod === null || $compressionMethod === ZipEntry::UNKNOWN) { |
@@ -806,8 +804,7 @@ discard block |
||
806 | 804 | rewind($stream); |
807 | 805 | $mimeType = FilesUtil::getMimeTypeFromString($bufferContents); |
808 | 806 | $compressionMethod = FilesUtil::isBadCompressionMimeType($mimeType) ? |
809 | - ZipCompressionMethod::STORED : |
|
810 | - ZipCompressionMethod::DEFLATED; |
|
807 | + ZipCompressionMethod::STORED : ZipCompressionMethod::DEFLATED; |
|
811 | 808 | } |
812 | 809 | $zipEntry->setUncompressedSize($length); |
813 | 810 | } |
@@ -845,7 +842,7 @@ discard block |
||
845 | 842 | if ($dirName === null) { |
846 | 843 | throw new InvalidArgumentException('Dir name is null'); |
847 | 844 | } |
848 | - $dirName = ltrim((string) $dirName, '\\/'); |
|
845 | + $dirName = ltrim((string)$dirName, '\\/'); |
|
849 | 846 | |
850 | 847 | if ($dirName === '') { |
851 | 848 | throw new InvalidArgumentException('Empty dir name'); |
@@ -887,7 +884,7 @@ discard block |
||
887 | 884 | if ($inputDir === null) { |
888 | 885 | throw new InvalidArgumentException('Input dir is null'); |
889 | 886 | } |
890 | - $inputDir = (string) $inputDir; |
|
887 | + $inputDir = (string)$inputDir; |
|
891 | 888 | |
892 | 889 | if ($inputDir === '') { |
893 | 890 | throw new InvalidArgumentException('The input directory is not specified'); |
@@ -926,7 +923,7 @@ discard block |
||
926 | 923 | if ($inputDir === null) { |
927 | 924 | throw new InvalidArgumentException('Input dir is null'); |
928 | 925 | } |
929 | - $inputDir = (string) $inputDir; |
|
926 | + $inputDir = (string)$inputDir; |
|
930 | 927 | |
931 | 928 | if ($inputDir === '') { |
932 | 929 | throw new InvalidArgumentException('The input directory is not specified'); |
@@ -965,7 +962,7 @@ discard block |
||
965 | 962 | $localPath = '/', |
966 | 963 | $compressionMethod = null |
967 | 964 | ) { |
968 | - $localPath = (string) $localPath; |
|
965 | + $localPath = (string)$localPath; |
|
969 | 966 | |
970 | 967 | if ($localPath !== '') { |
971 | 968 | $localPath = trim($localPath, '\\/'); |
@@ -974,8 +971,7 @@ discard block |
||
974 | 971 | } |
975 | 972 | |
976 | 973 | $iterator = $iterator instanceof \RecursiveIterator ? |
977 | - new \RecursiveIteratorIterator($iterator) : |
|
978 | - new \IteratorIterator($iterator); |
|
974 | + new \RecursiveIteratorIterator($iterator) : new \IteratorIterator($iterator); |
|
979 | 975 | /** |
980 | 976 | * @var string[] $files |
981 | 977 | * @var string $path |
@@ -1056,7 +1052,7 @@ discard block |
||
1056 | 1052 | if ($inputDir === null) { |
1057 | 1053 | throw new InvalidArgumentException('Input dir is null'); |
1058 | 1054 | } |
1059 | - $inputDir = (string) $inputDir; |
|
1055 | + $inputDir = (string)$inputDir; |
|
1060 | 1056 | |
1061 | 1057 | if ($inputDir === '') { |
1062 | 1058 | throw new InvalidArgumentException('The input directory is not specified'); |
@@ -1065,7 +1061,7 @@ discard block |
||
1065 | 1061 | if (!is_dir($inputDir)) { |
1066 | 1062 | throw new InvalidArgumentException(sprintf('The "%s" directory does not exist.', $inputDir)); |
1067 | 1063 | } |
1068 | - $globPattern = (string) $globPattern; |
|
1064 | + $globPattern = (string)$globPattern; |
|
1069 | 1065 | |
1070 | 1066 | if (empty($globPattern)) { |
1071 | 1067 | throw new InvalidArgumentException('The glob pattern is not specified'); |
@@ -1152,12 +1148,12 @@ discard block |
||
1152 | 1148 | $recursive = true, |
1153 | 1149 | $compressionMethod = null |
1154 | 1150 | ) { |
1155 | - $regexPattern = (string) $regexPattern; |
|
1151 | + $regexPattern = (string)$regexPattern; |
|
1156 | 1152 | |
1157 | 1153 | if (empty($regexPattern)) { |
1158 | 1154 | throw new InvalidArgumentException('The regex pattern is not specified'); |
1159 | 1155 | } |
1160 | - $inputDir = (string) $inputDir; |
|
1156 | + $inputDir = (string)$inputDir; |
|
1161 | 1157 | |
1162 | 1158 | if ($inputDir === '') { |
1163 | 1159 | throw new InvalidArgumentException('The input directory is not specified'); |
@@ -1263,8 +1259,8 @@ discard block |
||
1263 | 1259 | if ($oldName === null || $newName === null) { |
1264 | 1260 | throw new InvalidArgumentException('name is null'); |
1265 | 1261 | } |
1266 | - $oldName = ltrim((string) $oldName, '\\/'); |
|
1267 | - $newName = ltrim((string) $newName, '\\/'); |
|
1262 | + $oldName = ltrim((string)$oldName, '\\/'); |
|
1263 | + $newName = ltrim((string)$newName, '\\/'); |
|
1268 | 1264 | |
1269 | 1265 | if ($oldName !== $newName) { |
1270 | 1266 | $this->zipContainer->renameEntry($oldName, $newName); |
@@ -1284,7 +1280,7 @@ discard block |
||
1284 | 1280 | */ |
1285 | 1281 | public function deleteFromName($entryName) |
1286 | 1282 | { |
1287 | - $entryName = ltrim((string) $entryName, '\\/'); |
|
1283 | + $entryName = ltrim((string)$entryName, '\\/'); |
|
1288 | 1284 | |
1289 | 1285 | if (!$this->zipContainer->deleteEntry($entryName)) { |
1290 | 1286 | throw new ZipEntryNotFoundException($entryName); |
@@ -1357,7 +1353,7 @@ discard block |
||
1357 | 1353 | { |
1358 | 1354 | $this->matcher()->all()->invoke( |
1359 | 1355 | /** @param string $entry */ |
1360 | - function ($entry) use ($compressionLevel) { |
|
1356 | + function($entry) use ($compressionLevel) { |
|
1361 | 1357 | $this->setCompressionLevelEntry($entry, $compressionLevel); |
1362 | 1358 | } |
1363 | 1359 | ); |
@@ -1380,7 +1376,7 @@ discard block |
||
1380 | 1376 | */ |
1381 | 1377 | public function setCompressionLevelEntry($entryName, $compressionLevel) |
1382 | 1378 | { |
1383 | - $compressionLevel = (int) $compressionLevel; |
|
1379 | + $compressionLevel = (int)$compressionLevel; |
|
1384 | 1380 | $this->getEntry($entryName)->setCompressionLevel($compressionLevel); |
1385 | 1381 | |
1386 | 1382 | return $this; |
@@ -1570,7 +1566,7 @@ discard block |
||
1570 | 1566 | */ |
1571 | 1567 | public function saveAsFile($filename) |
1572 | 1568 | { |
1573 | - $filename = (string) $filename; |
|
1569 | + $filename = (string)$filename; |
|
1574 | 1570 | |
1575 | 1571 | $tempFilename = $filename . '.temp' . uniqid('', true); |
1576 | 1572 | |
@@ -1623,7 +1619,7 @@ discard block |
||
1623 | 1619 | */ |
1624 | 1620 | public function outputAsAttachment($outputFilename, $mimeType = null, $attachment = true) |
1625 | 1621 | { |
1626 | - $outputFilename = (string) $outputFilename; |
|
1622 | + $outputFilename = (string)$outputFilename; |
|
1627 | 1623 | |
1628 | 1624 | if ($mimeType === null) { |
1629 | 1625 | $mimeType = $this->getMimeTypeByFilename($outputFilename); |
@@ -1663,7 +1659,7 @@ discard block |
||
1663 | 1659 | */ |
1664 | 1660 | protected function getMimeTypeByFilename($outputFilename) |
1665 | 1661 | { |
1666 | - $outputFilename = (string) $outputFilename; |
|
1662 | + $outputFilename = (string)$outputFilename; |
|
1667 | 1663 | $ext = strtolower(pathinfo($outputFilename, \PATHINFO_EXTENSION)); |
1668 | 1664 | |
1669 | 1665 | if (!empty($ext) && isset(self::$defaultMimeTypes[$ext])) { |
@@ -1687,7 +1683,7 @@ discard block |
||
1687 | 1683 | */ |
1688 | 1684 | public function outputAsResponse(ResponseInterface $response, $outputFilename, $mimeType = null, $attachment = true) |
1689 | 1685 | { |
1690 | - $outputFilename = (string) $outputFilename; |
|
1686 | + $outputFilename = (string)$outputFilename; |
|
1691 | 1687 | |
1692 | 1688 | if ($mimeType === null) { |
1693 | 1689 | $mimeType = $this->getMimeTypeByFilename($outputFilename); |
@@ -1711,7 +1707,7 @@ discard block |
||
1711 | 1707 | |
1712 | 1708 | if ($size !== null) { |
1713 | 1709 | /** @noinspection CallableParameterUseCaseInTypeContextInspection */ |
1714 | - $response = $response->withHeader('Content-Length', (string) $size); |
|
1710 | + $response = $response->withHeader('Content-Length', (string)$size); |
|
1715 | 1711 | } |
1716 | 1712 | |
1717 | 1713 | return $response |
@@ -1837,7 +1833,7 @@ discard block |
||
1837 | 1833 | if ($entryName === null) { |
1838 | 1834 | throw new InvalidArgumentException('Key must not be null, but must contain the name of the zip entry.'); |
1839 | 1835 | } |
1840 | - $entryName = ltrim((string) $entryName, '\\/'); |
|
1836 | + $entryName = ltrim((string)$entryName, '\\/'); |
|
1841 | 1837 | |
1842 | 1838 | if ($entryName === '') { |
1843 | 1839 | throw new InvalidArgumentException('Key is empty, but must contain the name of the zip entry.'); |
@@ -1852,7 +1848,7 @@ discard block |
||
1852 | 1848 | } elseif (\is_resource($contents)) { |
1853 | 1849 | $this->addFromStream($contents, $entryName); |
1854 | 1850 | } else { |
1855 | - $this->addFromString($entryName, (string) $contents); |
|
1851 | + $this->addFromString($entryName, (string)$contents); |
|
1856 | 1852 | } |
1857 | 1853 | } |
1858 | 1854 |