@@ -33,7 +33,7 @@ |
||
| 33 | 33 | $entry_selector = $input->getArgument('entrySelector'); |
| 34 | 34 | |
| 35 | 35 | $archive->extractFiles($output_dir, $entry_selector, true); |
| 36 | - $output->writeln('<info>Extracted:</info> ' . implode(', ', $entry_selector) . ' (' . count($entry_selector) . ') file(s)'); |
|
| 36 | + $output->writeln('<info>Extracted:</info> '.implode(', ', $entry_selector).' ('.count($entry_selector).') file(s)'); |
|
| 37 | 37 | |
| 38 | 38 | return 0; |
| 39 | 39 | } |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | list($archive, $file) = $this->getArchiveAndFile($input, $output); |
| 34 | 34 | |
| 35 | 35 | $archive->deleteFiles($file); |
| 36 | - $output->writeln('<comment>- file "' . $file . '"</comment>'); |
|
| 36 | + $output->writeln('<comment>- file "'.$file.'"</comment>'); |
|
| 37 | 37 | |
| 38 | 38 | return 0; |
| 39 | 39 | } |
@@ -27,14 +27,14 @@ |
||
| 27 | 27 | list($archive, $file) = $this->getArchiveAndFile($input, $output); |
| 28 | 28 | $destination = $input->getArgument('destination'); |
| 29 | 29 | if (is_dir($destination)) { |
| 30 | - $destination = $destination . '/' . basename($file); |
|
| 30 | + $destination = $destination.'/'.basename($file); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | $overwrite = $input->getOption('overwrite'); |
| 34 | 34 | |
| 35 | 35 | if (file_exists($destination) && !$overwrite) { |
| 36 | 36 | if ($input->getOption('no-interaction')) { |
| 37 | - throw new \LogicException('File destination ' . $destination . ' exists'); |
|
| 37 | + throw new \LogicException('File destination '.$destination.' exists'); |
|
| 38 | 38 | } |
| 39 | 39 | } |
| 40 | 40 | |
@@ -46,8 +46,9 @@ |
||
| 46 | 46 | $this->compressedSize = $compressedSize; |
| 47 | 47 | $this->uncompressedSize = $uncompressedSize; |
| 48 | 48 | $this->modificationTime = $modificationTime; |
| 49 | - if ($isCompressed === null) |
|
| 50 | - $isCompressed = $uncompressedSize !== $compressedSize; |
|
| 49 | + if ($isCompressed === null) { |
|
| 50 | + $isCompressed = $uncompressedSize !== $compressedSize; |
|
| 51 | + } |
|
| 51 | 52 | $this->isCompressed = $isCompressed; |
| 52 | 53 | $this->comment = $comment; |
| 53 | 54 | $this->crc32 = $crc32; |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | public static function getInstallationInstruction() |
| 109 | 109 | { |
| 110 | 110 | if (!class_exists('\Archive7z\Archive7z')) |
| 111 | - return 'install library [gemorroj/archive7z]: `composer require gemorroj/archive7z`' . "\n" |
|
| 111 | + return 'install library [gemorroj/archive7z]: `composer require gemorroj/archive7z`'."\n" |
|
| 112 | 112 | . ' and console program p7zip [7za]: `apt install p7zip-full` - depends on OS'; |
| 113 | 113 | |
| 114 | 114 | if (Archive7z::getBinaryVersion() === false) |
@@ -150,8 +150,8 @@ discard block |
||
| 150 | 150 | $information->files[] = $can_get_unix_path |
| 151 | 151 | ? $entry->getUnixPath() |
| 152 | 152 | : str_replace('\\', '/', $entry->getPath()); |
| 153 | - $information->compressedFilesSize += (int)$entry->getPackedSize(); |
|
| 154 | - $information->uncompressedFilesSize += (int)$entry->getSize(); |
|
| 153 | + $information->compressedFilesSize += (int) $entry->getPackedSize(); |
|
| 154 | + $information->uncompressedFilesSize += (int) $entry->getSize(); |
|
| 155 | 155 | } |
| 156 | 156 | return $information; |
| 157 | 157 | } |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | { |
| 210 | 210 | $entry = $this->sevenZip->getEntry($fileName); |
| 211 | 211 | if ($entry === null) { |
| 212 | - throw new NonExistentArchiveFileException('File ' . $fileName . ' does not exist'); |
|
| 212 | + throw new NonExistentArchiveFileException('File '.$fileName.' does not exist'); |
|
| 213 | 213 | } |
| 214 | 214 | return $entry->getContent(); |
| 215 | 215 | } |
@@ -120,12 +120,14 @@ discard block |
||
| 120 | 120 | */ |
| 121 | 121 | public static function getInstallationInstruction() |
| 122 | 122 | { |
| 123 | - if (!class_exists('\Archive7z\Archive7z')) |
|
| 124 | - return 'install library [gemorroj/archive7z]: `composer require gemorroj/archive7z`' . "\n" |
|
| 123 | + if (!class_exists('\Archive7z\Archive7z')) { |
|
| 124 | + return 'install library [gemorroj/archive7z]: `composer require gemorroj/archive7z`' . "\n" |
|
| 125 | 125 | . ' and console program p7zip [7za]: `apt install p7zip-full` - depends on OS'; |
| 126 | + } |
|
| 126 | 127 | |
| 127 | - if (Archive7z::getBinaryVersion() === false) |
|
| 128 | - return 'install console program p7zip [7za]: `apt install p7zip-full` - depends on OS'; |
|
| 128 | + if (Archive7z::getBinaryVersion() === false) { |
|
| 129 | + return 'install console program p7zip [7za]: `apt install p7zip-full` - depends on OS'; |
|
| 130 | + } |
|
| 129 | 131 | |
| 130 | 132 | return null; |
| 131 | 133 | } |
@@ -138,8 +140,9 @@ discard block |
||
| 138 | 140 | try { |
| 139 | 141 | $this->format = $format; |
| 140 | 142 | $this->sevenZip = new Archive7z($archiveFileName, null, null); |
| 141 | - if ($password !== null) |
|
| 142 | - $this->sevenZip->setPassword($password); |
|
| 143 | + if ($password !== null) { |
|
| 144 | + $this->sevenZip->setPassword($password); |
|
| 145 | + } |
|
| 143 | 146 | } catch (\Archive7z\Exception $e) { |
| 144 | 147 | throw new Exception('Could not open 7Zip archive: '.$e->getMessage(), $e->getCode(), $e); |
| 145 | 148 | } |
@@ -157,8 +160,9 @@ discard block |
||
| 157 | 160 | continue; |
| 158 | 161 | } |
| 159 | 162 | |
| 160 | - if (!isset($can_get_unix_path)) |
|
| 161 | - $can_get_unix_path = method_exists($entry, 'getUnixPath'); |
|
| 163 | + if (!isset($can_get_unix_path)) { |
|
| 164 | + $can_get_unix_path = method_exists($entry, 'getUnixPath'); |
|
| 165 | + } |
|
| 162 | 166 | |
| 163 | 167 | $information->files[] = $can_get_unix_path |
| 164 | 168 | ? $entry->getUnixPath() |
@@ -176,8 +180,9 @@ discard block |
||
| 176 | 180 | { |
| 177 | 181 | $files = []; |
| 178 | 182 | foreach ($this->sevenZip->getEntries() as $entry) { |
| 179 | - if ($entry->isDirectory()) |
|
| 180 | - continue; |
|
| 183 | + if ($entry->isDirectory()) { |
|
| 184 | + continue; |
|
| 185 | + } |
|
| 181 | 186 | $files[] = $entry->getPath(); |
| 182 | 187 | } |
| 183 | 188 | return $files; |
@@ -329,8 +334,9 @@ discard block |
||
| 329 | 334 | public function addFileFromString($inArchiveName, $content) |
| 330 | 335 | { |
| 331 | 336 | $tmp_file = tempnam(sys_get_temp_dir(), 'ua'); |
| 332 | - if (!$tmp_file) |
|
| 333 | - throw new ArchiveModificationException('Could not create temporarily file'); |
|
| 337 | + if (!$tmp_file) { |
|
| 338 | + throw new ArchiveModificationException('Could not create temporarily file'); |
|
| 339 | + } |
|
| 334 | 340 | |
| 335 | 341 | file_put_contents($tmp_file, $content); |
| 336 | 342 | $this->sevenZip->addEntry($tmp_file, true); |
@@ -380,8 +386,9 @@ discard block |
||
| 380 | 386 | $total_files = count($files); |
| 381 | 387 | |
| 382 | 388 | $seven_zip = new Archive7z($archiveFileName); |
| 383 | - if ($password !== null) |
|
| 384 | - $seven_zip->setPassword($password); |
|
| 389 | + if ($password !== null) { |
|
| 390 | + $seven_zip->setPassword($password); |
|
| 391 | + } |
|
| 385 | 392 | $seven_zip->setCompressionLevel($compressionLevelMap[$compressionLevel]); |
| 386 | 393 | foreach ($files as $localName => $filename) { |
| 387 | 394 | if ($filename !== null) { |
@@ -41,7 +41,7 @@ |
||
| 41 | 41 | $question = new ChoiceQuestion('Which format', array_keys($formats)); |
| 42 | 42 | $format = $helper->ask($input, $output, $question); |
| 43 | 43 | } |
| 44 | - $output->writeln('Format <info>' . $format . '</info> drivers support'); |
|
| 44 | + $output->writeln('Format <info>'.$format.'</info> drivers support'); |
|
| 45 | 45 | |
| 46 | 46 | $table = new Table($output); |
| 47 | 47 | $table->setHeaders(['format', ...array_keys(self::$abilitiesLabels)]); |
@@ -61,10 +61,11 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | protected static function init() |
| 63 | 63 | { |
| 64 | - if (!class_exists('\Alchemy\Zippy\Zippy')) |
|
| 65 | - static::$zippy = false; |
|
| 66 | - else if (static::$zippy === null) |
|
| 67 | - static::$zippy = Zippy::load(); |
|
| 64 | + if (!class_exists('\Alchemy\Zippy\Zippy')) { |
|
| 65 | + static::$zippy = false; |
|
| 66 | + } else if (static::$zippy === null) { |
|
| 67 | + static::$zippy = Zippy::load(); |
|
| 68 | + } |
|
| 68 | 69 | } |
| 69 | 70 | |
| 70 | 71 | /** |
@@ -75,8 +76,9 @@ discard block |
||
| 75 | 76 | { |
| 76 | 77 | static::init(); |
| 77 | 78 | |
| 78 | - if (static::$zippy === false) |
|
| 79 | - return []; |
|
| 79 | + if (static::$zippy === false) { |
|
| 80 | + return []; |
|
| 81 | + } |
|
| 80 | 82 | |
| 81 | 83 | switch ($format) { |
| 82 | 84 | case Formats::TAR_BZIP: |
@@ -212,8 +214,9 @@ discard block |
||
| 212 | 214 | $information = new ArchiveInformation(); |
| 213 | 215 | |
| 214 | 216 | foreach ($this->archive->getMembers() as $member) { |
| 215 | - if ($member->isDir()) |
|
| 216 | - continue; |
|
| 217 | + if ($member->isDir()) { |
|
| 218 | + continue; |
|
| 219 | + } |
|
| 217 | 220 | |
| 218 | 221 | $this->files[] = $information->files[] = str_replace('\\', '/', $member->getLocation()); |
| 219 | 222 | $this->members[str_replace('\\', '/', $member->getLocation())] = $member; |
@@ -63,9 +63,9 @@ discard block |
||
| 63 | 63 | public static function getInstallationInstruction() |
| 64 | 64 | { |
| 65 | 65 | self::init(); |
| 66 | - return 'install library [alchemy/zippy]: `composer require alchemy/zippy`' . "\n" . ' and console programs (tar, zip): `apt install tar zip` - depends on OS' |
|
| 67 | - . "\n" . 'If you install SevenZip and AlchemyZippy:' . "\n" . |
|
| 68 | - '1. You should specify symfony/console version before installation to any **3.x.x version**:' . "\n" . '`composer require symfony/process:~3.4`, because they require different `symfony/process` versions.' . "\n" . |
|
| 66 | + return 'install library [alchemy/zippy]: `composer require alchemy/zippy`'."\n".' and console programs (tar, zip): `apt install tar zip` - depends on OS' |
|
| 67 | + . "\n".'If you install SevenZip and AlchemyZippy:'."\n". |
|
| 68 | + '1. You should specify symfony/console version before installation to any **3.x.x version**:'."\n".'`composer require symfony/process:~3.4`, because they require different `symfony/process` versions.'."\n". |
|
| 69 | 69 | '2. Install archive7z version 4.0.0: `composer require gemorroj/archive7z:~4.0`'; |
| 70 | 70 | } |
| 71 | 71 | |
@@ -190,8 +190,8 @@ discard block |
||
| 190 | 190 | |
| 191 | 191 | $this->files[] = $information->files[] = str_replace('\\', '/', $member->getLocation()); |
| 192 | 192 | $this->members[str_replace('\\', '/', $member->getLocation())] = $member; |
| 193 | - $information->compressedFilesSize += (int)$member->getSize(); |
|
| 194 | - $information->uncompressedFilesSize += (int)$member->getSize(); |
|
| 193 | + $information->compressedFilesSize += (int) $member->getSize(); |
|
| 194 | + $information->uncompressedFilesSize += (int) $member->getSize(); |
|
| 195 | 195 | } |
| 196 | 196 | return $information; |
| 197 | 197 | } |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | public function getFileContent($fileName) |
| 241 | 241 | { |
| 242 | 242 | $member = $this->getMember($fileName); |
| 243 | - return (string)$member; |
|
| 243 | + return (string) $member; |
|
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | /** |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | public function getFileStream($fileName) |
| 250 | 250 | { |
| 251 | 251 | $member = $this->getMember($fileName); |
| 252 | - return self::wrapStringInStream((string)$member); |
|
| 252 | + return self::wrapStringInStream((string) $member); |
|
| 253 | 253 | } |
| 254 | 254 | |
| 255 | 255 | /** |
@@ -257,13 +257,15 @@ discard block |
||
| 257 | 257 | */ |
| 258 | 258 | public function getFileNames($filter = null) |
| 259 | 259 | { |
| 260 | - if ($filter === null) |
|
| 261 | - return $this->files; |
|
| 260 | + if ($filter === null) { |
|
| 261 | + return $this->files; |
|
| 262 | + } |
|
| 262 | 263 | |
| 263 | 264 | $result = []; |
| 264 | 265 | foreach ($this->files as $file) { |
| 265 | - if (fnmatch($filter, $file)) |
|
| 266 | - $result[] = $file; |
|
| 266 | + if (fnmatch($filter, $file)) { |
|
| 267 | + $result[] = $file; |
|
| 268 | + } |
|
| 267 | 269 | } |
| 268 | 270 | return $result; |
| 269 | 271 | } |
@@ -390,8 +392,9 @@ discard block |
||
| 390 | 392 | { |
| 391 | 393 | $files_list = static::createFilesList($fileOrFiles); |
| 392 | 394 | |
| 393 | - if (empty($files_list)) |
|
| 394 | - throw new EmptyFileListException('Files list is empty!'); |
|
| 395 | + if (empty($files_list)) { |
|
| 396 | + throw new EmptyFileListException('Files list is empty!'); |
|
| 397 | + } |
|
| 395 | 398 | |
| 396 | 399 | $result = $this->archive->addFiles($files_list); |
| 397 | 400 | $this->scanArchive(); |
@@ -410,8 +413,9 @@ discard block |
||
| 410 | 413 | */ |
| 411 | 414 | public function addFile($file, $inArchiveName = null) |
| 412 | 415 | { |
| 413 | - if (!is_file($file)) |
|
| 414 | - throw new InvalidArgumentException($file.' is not a valid file to add in archive'); |
|
| 416 | + if (!is_file($file)) { |
|
| 417 | + throw new InvalidArgumentException($file.' is not a valid file to add in archive'); |
|
| 418 | + } |
|
| 415 | 419 | |
| 416 | 420 | return ($inArchiveName !== null |
| 417 | 421 | ? $this->addFiles([$inArchiveName => $file]) |
@@ -444,8 +448,9 @@ discard block |
||
| 444 | 448 | */ |
| 445 | 449 | public function addDirectory($directory, $inArchivePath = null) |
| 446 | 450 | { |
| 447 | - if (!is_dir($directory) || !is_readable($directory)) |
|
| 448 | - throw new InvalidArgumentException($directory.' is not a valid directory to add in archive'); |
|
| 451 | + if (!is_dir($directory) || !is_readable($directory)) { |
|
| 452 | + throw new InvalidArgumentException($directory.' is not a valid directory to add in archive'); |
|
| 453 | + } |
|
| 449 | 454 | |
| 450 | 455 | return ($inArchivePath !== null |
| 451 | 456 | ? $this->addFiles([$inArchivePath => $directory]) |
@@ -494,13 +499,15 @@ discard block |
||
| 494 | 499 | { |
| 495 | 500 | $archiveType = Formats::detectArchiveFormat($archiveName, false); |
| 496 | 501 | |
| 497 | - if ($archiveType === false) |
|
| 498 | - throw new UnsupportedArchiveException('Could not detect archive type for name "'.$archiveName.'"'); |
|
| 502 | + if ($archiveType === false) { |
|
| 503 | + throw new UnsupportedArchiveException('Could not detect archive type for name "'.$archiveName.'"'); |
|
| 504 | + } |
|
| 499 | 505 | |
| 500 | 506 | $files_list = static::createFilesList($fileOrFiles); |
| 501 | 507 | |
| 502 | - if (empty($files_list)) |
|
| 503 | - throw new EmptyFileListException('Files list is empty!'); |
|
| 508 | + if (empty($files_list)) { |
|
| 509 | + throw new EmptyFileListException('Files list is empty!'); |
|
| 510 | + } |
|
| 504 | 511 | |
| 505 | 512 | $totalSize = 0; |
| 506 | 513 | foreach ($files_list as $fn) { |
@@ -554,18 +561,21 @@ discard block |
||
| 554 | 561 | $fileProgressCallable = null |
| 555 | 562 | ) |
| 556 | 563 | { |
| 557 | - if (file_exists($archiveName)) |
|
| 558 | - throw new FileAlreadyExistsException('Archive '.$archiveName.' already exists!'); |
|
| 564 | + if (file_exists($archiveName)) { |
|
| 565 | + throw new FileAlreadyExistsException('Archive '.$archiveName.' already exists!'); |
|
| 566 | + } |
|
| 559 | 567 | |
| 560 | 568 | $info = static::prepareForArchiving($fileOrFiles, $archiveName); |
| 561 | 569 | |
| 562 | 570 | $abilities = [BasicDriver::CREATE]; |
| 563 | 571 | |
| 564 | - if (!Formats::canCreate($info['type'])) |
|
| 565 | - throw new UnsupportedArchiveException('Unsupported archive type: '.$info['type'].' of archive '.$archiveName); |
|
| 572 | + if (!Formats::canCreate($info['type'])) { |
|
| 573 | + throw new UnsupportedArchiveException('Unsupported archive type: '.$info['type'].' of archive '.$archiveName); |
|
| 574 | + } |
|
| 566 | 575 | |
| 567 | - if ($password !== null && !Formats::canEncrypt($info['type'])) |
|
| 568 | - throw new UnsupportedOperationException('Archive type '.$info['type'].' can not be encrypted'); |
|
| 576 | + if ($password !== null && !Formats::canEncrypt($info['type'])) { |
|
| 577 | + throw new UnsupportedOperationException('Archive type '.$info['type'].' can not be encrypted'); |
|
| 578 | + } |
|
| 569 | 579 | if ($password !== null) { |
| 570 | 580 | $abilities[] = BasicDriver::CREATE_ENCRYPTED; |
| 571 | 581 | } |
@@ -619,8 +629,9 @@ discard block |
||
| 619 | 629 | */ |
| 620 | 630 | public static function archiveDirectory($directory, $archiveName, $compressionLevel = BasicDriver::COMPRESSION_AVERAGE, $password = null) |
| 621 | 631 | { |
| 622 | - if (!is_dir($directory) || !is_readable($directory)) |
|
| 623 | - throw new InvalidArgumentException($directory.' is not a valid directory to archive'); |
|
| 632 | + if (!is_dir($directory) || !is_readable($directory)) { |
|
| 633 | + throw new InvalidArgumentException($directory.' is not a valid directory to archive'); |
|
| 634 | + } |
|
| 624 | 635 | |
| 625 | 636 | return static::archiveFiles($directory, $archiveName, $compressionLevel, $password) > 0; |
| 626 | 637 | } |
@@ -656,9 +667,9 @@ discard block |
||
| 656 | 667 | if (is_array($nodes)) { |
| 657 | 668 | foreach ($nodes as $destination => $source) { |
| 658 | 669 | // new format |
| 659 | - if (is_numeric($destination)) |
|
| 660 | - $destination = $source; |
|
| 661 | - else { |
|
| 670 | + if (is_numeric($destination)) { |
|
| 671 | + $destination = $source; |
|
| 672 | + } else { |
|
| 662 | 673 | // old format |
| 663 | 674 | if (is_string($source) && !file_exists($source)) { |
| 664 | 675 | list($destination, $source) = [$source, $destination]; |
@@ -692,11 +703,12 @@ discard block |
||
| 692 | 703 | |
| 693 | 704 | } else if (is_string($nodes)) { // passed one file or directory |
| 694 | 705 | // if is directory |
| 695 | - if (is_dir($nodes)) |
|
| 696 | - static::importFilesFromDir(rtrim($nodes, '/\\*').'/*', null, true, |
|
| 706 | + if (is_dir($nodes)) { |
|
| 707 | + static::importFilesFromDir(rtrim($nodes, '/\\*').'/*', null, true, |
|
| 697 | 708 | $files); |
| 698 | - else if (is_file($nodes)) |
|
| 699 | - $files[basename($nodes)] = $nodes; |
|
| 709 | + } else if (is_file($nodes)) { |
|
| 710 | + $files[basename($nodes)] = $nodes; |
|
| 711 | + } |
|
| 700 | 712 | } |
| 701 | 713 | |
| 702 | 714 | return $files; |
@@ -713,8 +725,9 @@ discard block |
||
| 713 | 725 | // $map[$destination] = rtrim($source, '/*'); |
| 714 | 726 | // do not map root archive folder |
| 715 | 727 | |
| 716 | - if ($destination !== null) |
|
| 717 | - $map[$destination] = null; |
|
| 728 | + if ($destination !== null) { |
|
| 729 | + $map[$destination] = null; |
|
| 730 | + } |
|
| 718 | 731 | |
| 719 | 732 | foreach (glob($source, GLOB_MARK) as $node) { |
| 720 | 733 | if (in_array(substr($node, -1), ['/', '\\'], true) && $recursive) { |
@@ -64,7 +64,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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); |
@@ -582,7 +582,7 @@ discard block |
||
| 582 | 582 | /** @var BasicDriver $driver */ |
| 583 | 583 | $driver = Formats::getFormatDriver($info['type'], $abilities); |
| 584 | 584 | if ($driver === null) { |
| 585 | - throw new UnsupportedArchiveException('Unsupported archive type: ' . $info['type'] . ' of archive '); |
|
| 585 | + throw new UnsupportedArchiveException('Unsupported archive type: '.$info['type'].' of archive '); |
|
| 586 | 586 | } |
| 587 | 587 | |
| 588 | 588 | return $driver::createArchive( |
@@ -609,7 +609,7 @@ discard block |
||
| 609 | 609 | public static function archiveFile($file, $archiveName, $compressionLevel = BasicDriver::COMPRESSION_AVERAGE, $password = null) |
| 610 | 610 | { |
| 611 | 611 | if (!is_file($file)) { |
| 612 | - throw new InvalidArgumentException($file . ' is not a valid file to archive'); |
|
| 612 | + throw new InvalidArgumentException($file.' is not a valid file to archive'); |
|
| 613 | 613 | } |
| 614 | 614 | |
| 615 | 615 | return static::archiveFiles($file, $archiveName, $compressionLevel, $password) === 1; |
@@ -680,8 +680,8 @@ discard block |
||
| 680 | 680 | if (is_array($source)) { |
| 681 | 681 | foreach ($source as $sourceItem) { |
| 682 | 682 | static::importFilesFromDir( |
| 683 | - rtrim($sourceItem, '/\\*') . '/*', |
|
| 684 | - !empty($destination) ? $destination . '/' : null, |
|
| 683 | + rtrim($sourceItem, '/\\*').'/*', |
|
| 684 | + !empty($destination) ? $destination.'/' : null, |
|
| 685 | 685 | true, |
| 686 | 686 | $files |
| 687 | 687 | ); |
@@ -689,8 +689,8 @@ discard block |
||
| 689 | 689 | } else if (is_dir($source)) { |
| 690 | 690 | // one source for directories |
| 691 | 691 | static::importFilesFromDir( |
| 692 | - rtrim($source, '/\\*') . '/*', |
|
| 693 | - !empty($destination) ? $destination . '/' : null, |
|
| 692 | + rtrim($source, '/\\*').'/*', |
|
| 693 | + !empty($destination) ? $destination.'/' : null, |
|
| 694 | 694 | true, |
| 695 | 695 | $files |
| 696 | 696 | ); |
@@ -160,8 +160,9 @@ |
||
| 160 | 160 | // by file content |
| 161 | 161 | if ($contentCheck) { |
| 162 | 162 | $mime_type = mime_content_type($fileName); |
| 163 | - if (isset(static::$mimeTypes[$mime_type])) |
|
| 164 | - return static::$mimeTypes[$mime_type]; |
|
| 163 | + if (isset(static::$mimeTypes[$mime_type])) { |
|
| 164 | + return static::$mimeTypes[$mime_type]; |
|
| 165 | + } |
|
| 165 | 166 | } |
| 166 | 167 | |
| 167 | 168 | return false; |