@@ -29,20 +29,20 @@ |
||
| 29 | 29 | protected function getArchive(InputInterface $input, OutputInterface $output) |
| 30 | 30 | { |
| 31 | 31 | $file = realpath($input->getArgument('archive')); |
| 32 | - $output->writeln('<comment>Opening ' . $file . '</comment>', OutputInterface::VERBOSITY_VERY_VERBOSE); |
|
| 32 | + $output->writeln('<comment>Opening '.$file.'</comment>', OutputInterface::VERBOSITY_VERY_VERBOSE); |
|
| 33 | 33 | if (!is_file($file)) { |
| 34 | - throw new \InvalidArgumentException('File ' . $input->getArgument('archive') . ' is not accessible'); |
|
| 34 | + throw new \InvalidArgumentException('File '.$input->getArgument('archive').' is not accessible'); |
|
| 35 | 35 | } |
| 36 | - $output->writeln('<comment>Format ' . Formats::detectArchiveFormat($file).'</comment>', OutputInterface::VERBOSITY_VERY_VERBOSE); |
|
| 36 | + $output->writeln('<comment>Format '.Formats::detectArchiveFormat($file).'</comment>', OutputInterface::VERBOSITY_VERY_VERBOSE); |
|
| 37 | 37 | $password = $input->getOption('password'); |
| 38 | 38 | if (empty($password)) { |
| 39 | 39 | $password = null; |
| 40 | 40 | } else { |
| 41 | - $output->writeln('<comment>Passing password: ' . strlen($password).'</comment>', OutputInterface::VERBOSITY_VERY_VERBOSE); |
|
| 41 | + $output->writeln('<comment>Passing password: '.strlen($password).'</comment>', OutputInterface::VERBOSITY_VERY_VERBOSE); |
|
| 42 | 42 | } |
| 43 | 43 | $archive = $this->open($file, $password); |
| 44 | - $output->writeln('<comment>Driver ' . $archive->getDriverType() . '</comment>', OutputInterface::VERBOSITY_VERBOSE); |
|
| 45 | - $output->writeln('<comment>Driver abilities: ' . implode(', ', $this->getDriverFormatAbilities($archive->getDriverType(), $archive->getFormat())) . '</comment>', OutputInterface::VERBOSITY_VERBOSE); |
|
| 44 | + $output->writeln('<comment>Driver '.$archive->getDriverType().'</comment>', OutputInterface::VERBOSITY_VERBOSE); |
|
| 45 | + $output->writeln('<comment>Driver abilities: '.implode(', ', $this->getDriverFormatAbilities($archive->getDriverType(), $archive->getFormat())).'</comment>', OutputInterface::VERBOSITY_VERBOSE); |
|
| 46 | 46 | return $archive; |
| 47 | 47 | } |
| 48 | 48 | |
@@ -58,9 +58,9 @@ |
||
| 58 | 58 | $comment = $input->getOption('comment'); |
| 59 | 59 | |
| 60 | 60 | if (file_exists($archive_file)) { |
| 61 | - if (is_dir($archive_file)) |
|
| 62 | - throw new \InvalidArgumentException($archive_file . ' is a directory!'); |
|
| 63 | - else { |
|
| 61 | + if (is_dir($archive_file)) { |
|
| 62 | + throw new \InvalidArgumentException($archive_file . ' is a directory!'); |
|
| 63 | + } else { |
|
| 64 | 64 | throw new \InvalidArgumentException('File "' . $archive_file . '" already exists!'); |
| 65 | 65 | } |
| 66 | 66 | } |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | $password = $input->getOption('password'); |
| 48 | 48 | $compression = $input->getOption('compression'); |
| 49 | 49 | if (!isset(static::$compressionLevels[$compression])) { |
| 50 | - throw new \InvalidArgumentException('Compression "' . $compression . '" is not valid'); |
|
| 50 | + throw new \InvalidArgumentException('Compression "'.$compression.'" is not valid'); |
|
| 51 | 51 | } |
| 52 | 52 | $compression = static::$compressionLevels[$compression]; |
| 53 | 53 | $path = $input->getOption('path'); |
@@ -59,9 +59,9 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | if (file_exists($archive_file)) { |
| 61 | 61 | if (is_dir($archive_file)) |
| 62 | - throw new \InvalidArgumentException($archive_file . ' is a directory!'); |
|
| 62 | + throw new \InvalidArgumentException($archive_file.' is a directory!'); |
|
| 63 | 63 | else { |
| 64 | - throw new \InvalidArgumentException('File "' . $archive_file . '" already exists!'); |
|
| 64 | + throw new \InvalidArgumentException('File "'.$archive_file.'" already exists!'); |
|
| 65 | 65 | } |
| 66 | 66 | } |
| 67 | 67 | |
@@ -73,11 +73,11 @@ discard block |
||
| 73 | 73 | case 'full': |
| 74 | 74 | $destination = ltrim($file_to_pack, '/'); |
| 75 | 75 | $files_list[$destination] = $file_to_pack; |
| 76 | - $output->writeln('<comment>' . $file_to_pack . ' => ' . $destination . '</comment>', OutputInterface::VERBOSITY_VERBOSE); |
|
| 76 | + $output->writeln('<comment>'.$file_to_pack.' => '.$destination.'</comment>', OutputInterface::VERBOSITY_VERBOSE); |
|
| 77 | 77 | break; |
| 78 | 78 | case 'root': |
| 79 | 79 | if (is_dir($file_to_pack)) { |
| 80 | - $output->writeln('<comment>' . $file_to_pack . ' => root</comment>', OutputInterface::VERBOSITY_VERBOSE); |
|
| 80 | + $output->writeln('<comment>'.$file_to_pack.' => root</comment>', OutputInterface::VERBOSITY_VERBOSE); |
|
| 81 | 81 | if (!isset($files_list[''])) { |
| 82 | 82 | $files_list[''] = $file_to_pack; |
| 83 | 83 | } elseif (is_string($files_list[''])) { |
@@ -86,35 +86,35 @@ discard block |
||
| 86 | 86 | $files_list[''][] = $file_to_pack; |
| 87 | 87 | } |
| 88 | 88 | } else { |
| 89 | - $output->writeln('<comment>' . $file_to_pack . ' => ' . basename($file_to_pack) . '</comment>', OutputInterface::VERBOSITY_VERBOSE); |
|
| 89 | + $output->writeln('<comment>'.$file_to_pack.' => '.basename($file_to_pack).'</comment>', OutputInterface::VERBOSITY_VERBOSE); |
|
| 90 | 90 | $files_list[basename($file_to_pack)] = $file_to_pack; |
| 91 | 91 | } |
| 92 | 92 | break; |
| 93 | 93 | case 'relative': |
| 94 | 94 | $destination = ltrim($file_to_pack, '/.'); |
| 95 | 95 | $files_list[$destination] = $file_to_pack; |
| 96 | - $output->writeln('<comment>' . $file_to_pack . ' => ' . $destination . '</comment>', OutputInterface::VERBOSITY_VERBOSE); |
|
| 96 | + $output->writeln('<comment>'.$file_to_pack.' => '.$destination.'</comment>', OutputInterface::VERBOSITY_VERBOSE); |
|
| 97 | 97 | break; |
| 98 | 98 | case 'basename': |
| 99 | 99 | $destination = basename($file_to_pack); |
| 100 | 100 | $files_list[$destination] = $file_to_pack; |
| 101 | - $output->writeln('<comment>' . $file_to_pack . ' => ' . $destination . '</comment>', OutputInterface::VERBOSITY_VERBOSE); |
|
| 101 | + $output->writeln('<comment>'.$file_to_pack.' => '.$destination.'</comment>', OutputInterface::VERBOSITY_VERBOSE); |
|
| 102 | 102 | break; |
| 103 | 103 | } |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | $information = UnifiedArchive::prepareForArchiving($files_list, $archive_file); |
| 107 | 107 | if ($dry_run) { |
| 108 | - $output->writeln('Format: <info>' . $information['type'] . '</info>'); |
|
| 109 | - $output->writeln('Original size: <info>' . implode($this->formatSize($information['totalSize'])) . '</info>'); |
|
| 110 | - $output->writeln('Files: <info>' . $information['numberOfFiles'] . '</info>'); |
|
| 108 | + $output->writeln('Format: <info>'.$information['type'].'</info>'); |
|
| 109 | + $output->writeln('Original size: <info>'.implode($this->formatSize($information['totalSize'])).'</info>'); |
|
| 110 | + $output->writeln('Files: <info>'.$information['numberOfFiles'].'</info>'); |
|
| 111 | 111 | foreach ($information['files'] as $destination => $source) { |
| 112 | 112 | // is folder |
| 113 | 113 | if ($source === null) { |
| 114 | 114 | continue; |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | - $output->writeln($source . ' => <comment>' . $destination . '</comment>'); |
|
| 117 | + $output->writeln($source.' => <comment>'.$destination.'</comment>'); |
|
| 118 | 118 | } |
| 119 | 119 | return 0; |
| 120 | 120 | } |
@@ -124,10 +124,10 @@ discard block |
||
| 124 | 124 | $progressBar = new ProgressBar($output, $information['numberOfFiles']); |
| 125 | 125 | $progressBar->setFormat('archiving'); |
| 126 | 126 | $progressBar->start(); |
| 127 | - $archived_files = UnifiedArchive::archive($files_list, $archive_file, $compression, $password, function ($currentFile, $totalFiles, $fsFilename, $archiveFilename) |
|
| 127 | + $archived_files = UnifiedArchive::archive($files_list, $archive_file, $compression, $password, function($currentFile, $totalFiles, $fsFilename, $archiveFilename) |
|
| 128 | 128 | use ($progressBar) { |
| 129 | 129 | if ($fsFilename === null) { |
| 130 | - $progressBar->setMessage('Creating ' . $archiveFilename); |
|
| 130 | + $progressBar->setMessage('Creating '.$archiveFilename); |
|
| 131 | 131 | } else { |
| 132 | 132 | $progressBar->setMessage($fsFilename); |
| 133 | 133 | } |
@@ -146,8 +146,8 @@ discard block |
||
| 146 | 146 | $archive->setComment($comment); |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | - $output->writeln('Created <info>' . $archive_file . '</info> with <comment>' . $archived_files . '</comment> file(s) (' |
|
| 150 | - . implode($this->formatSize($archive->getOriginalSize())) . ') of total size ' |
|
| 149 | + $output->writeln('Created <info>'.$archive_file.'</info> with <comment>'.$archived_files.'</comment> file(s) (' |
|
| 150 | + . implode($this->formatSize($archive->getOriginalSize())).') of total size ' |
|
| 151 | 151 | . implode($this->formatSize(filesize($archive_file)))); |
| 152 | 152 | |
| 153 | 153 | return 0; |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | |
| 273 | 273 | $report = array(); |
| 274 | 274 | foreach ($this->listContent() as $file_header) { |
| 275 | - $file_header = (object)$file_header; |
|
| 275 | + $file_header = (object) $file_header; |
|
| 276 | 276 | // add file information to report |
| 277 | 277 | $report[] = $file_header; |
| 278 | 278 | // refuse by select rule |
@@ -406,7 +406,7 @@ discard block |
||
| 406 | 406 | } |
| 407 | 407 | |
| 408 | 408 | foreach ($report as $i => $reportItem) { |
| 409 | - $report[$i] = (array)$reportItem; |
|
| 409 | + $report[$i] = (array) $reportItem; |
|
| 410 | 410 | } |
| 411 | 411 | |
| 412 | 412 | return $report; |
@@ -457,7 +457,7 @@ discard block |
||
| 457 | 457 | |
| 458 | 458 | $report = []; |
| 459 | 459 | foreach ($this->listContent() as $file_header) { |
| 460 | - $file_header = (object)$file_header; |
|
| 460 | + $file_header = (object) $file_header; |
|
| 461 | 461 | // select by select rule |
| 462 | 462 | if (call_user_func($selectFilter, $file_header->stored_filename, |
| 463 | 463 | $file_header->filename, $file_header->index) |
@@ -477,7 +477,7 @@ discard block |
||
| 477 | 477 | } |
| 478 | 478 | |
| 479 | 479 | foreach ($report as $i => $reportItem) { |
| 480 | - $report[$i] = (array)$reportItem; |
|
| 480 | + $report[$i] = (array) $reportItem; |
|
| 481 | 481 | } |
| 482 | 482 | |
| 483 | 483 | return $report; |
@@ -539,7 +539,7 @@ discard block |
||
| 539 | 539 | } |
| 540 | 540 | } |
| 541 | 541 | |
| 542 | - call_user_func(function ($directory) { |
|
| 542 | + call_user_func(function($directory) { |
|
| 543 | 543 | foreach (glob($directory.'/*') as $f) { |
| 544 | 544 | if (is_dir($f)) call_user_func(__FUNCTION__, $f); |
| 545 | 545 | else unlink($f); |
@@ -568,16 +568,16 @@ discard block |
||
| 568 | 568 | $filters = array(); |
| 569 | 569 | if (isset($options[PCLZIP_OPT_REMOVE_PATH]) |
| 570 | 570 | && !isset($options[PCLZIP_OPT_REMOVE_ALL_PATH])) |
| 571 | - $filters[] = function (&$key, &$value) use ($options) { |
|
| 571 | + $filters[] = function(&$key, &$value) use ($options) { |
|
| 572 | 572 | $key = str_replace($key, null, $key); |
| 573 | 573 | }; |
| 574 | 574 | if (isset($options[PCLZIP_OPT_REMOVE_ALL_PATH])) |
| 575 | - $filters[] = function (&$key, &$value) { |
|
| 575 | + $filters[] = function(&$key, &$value) { |
|
| 576 | 576 | $key = basename($key); |
| 577 | 577 | }; |
| 578 | 578 | if (isset($options[PCLZIP_OPT_ADD_PATH])) |
| 579 | - $filters[] = function (&$key, &$value) use ($options) { |
|
| 580 | - $key = rtrim($options[PCLZIP_OPT_ADD_PATH], '/') . '/' . |
|
| 579 | + $filters[] = function(&$key, &$value) use ($options) { |
|
| 580 | + $key = rtrim($options[PCLZIP_OPT_ADD_PATH], '/').'/'. |
|
| 581 | 581 | ltrim($key, '/'); |
| 582 | 582 | }; |
| 583 | 583 | return $filters; |
@@ -591,7 +591,7 @@ discard block |
||
| 591 | 591 | */ |
| 592 | 592 | private function extractCallbacks(array $options, $preCallbackConst, $postCallbackConst) |
| 593 | 593 | { |
| 594 | - $preCallback = $postCallback = function () { return true; }; |
|
| 594 | + $preCallback = $postCallback = function() { return true; }; |
|
| 595 | 595 | |
| 596 | 596 | if (isset($options[$preCallbackConst]) && is_callable($options[$preCallbackConst])) |
| 597 | 597 | $preCallback = $options[$preCallbackConst]; |
@@ -608,8 +608,8 @@ discard block |
||
| 608 | 608 | */ |
| 609 | 609 | private function makeKeyValueArrayFromList(array $options) |
| 610 | 610 | { |
| 611 | - $keys = array_filter($options, function ($v) {return ($v%2) == 0;}, ARRAY_FILTER_USE_KEY); |
|
| 612 | - $values = array_filter($options, function ($v) {return ($v%2) == 1;}, ARRAY_FILTER_USE_KEY); |
|
| 611 | + $keys = array_filter($options, function($v) {return ($v % 2) == 0; }, ARRAY_FILTER_USE_KEY); |
|
| 612 | + $values = array_filter($options, function($v) {return ($v % 2) == 1; }, ARRAY_FILTER_USE_KEY); |
|
| 613 | 613 | if (count($values) < count($keys)) $values[] = true; |
| 614 | 614 | return array_combine($keys, $values); |
| 615 | 615 | } |
@@ -658,7 +658,7 @@ discard block |
||
| 658 | 658 | range($parts[0], $parts[1]), $allowedIndexes); |
| 659 | 659 | } |
| 660 | 660 | |
| 661 | - return function ($key, $value, $index) use ($allowedIndexes) { |
|
| 661 | + return function($key, $value, $index) use ($allowedIndexes) { |
|
| 662 | 662 | return in_array($index, $allowedIndexes) |
| 663 | 663 | ? self::SELECT_FILTER_PASS |
| 664 | 664 | : self::SELECT_FILTER_REFUSE; |
@@ -675,7 +675,7 @@ discard block |
||
| 675 | 675 | ? $names |
| 676 | 676 | : explode(',', $names); |
| 677 | 677 | |
| 678 | - return function ($key, $value) use ($allowedNames) { |
|
| 678 | + return function($key, $value) use ($allowedNames) { |
|
| 679 | 679 | foreach ($allowedNames as $name) { |
| 680 | 680 | // select directory with nested files |
| 681 | 681 | if (in_array(substr($name, -1), ['/', '\\'])) { |
@@ -703,7 +703,7 @@ discard block |
||
| 703 | 703 | */ |
| 704 | 704 | protected function createByEregSelector($regex) |
| 705 | 705 | { |
| 706 | - return function ($key, $value) use ($regex) { |
|
| 706 | + return function($key, $value) use ($regex) { |
|
| 707 | 707 | return (ereg($regex, $key) !== false) |
| 708 | 708 | ? self::SELECT_FILTER_PASS |
| 709 | 709 | : self::SELECT_FILTER_REFUSE; |
@@ -716,7 +716,7 @@ discard block |
||
| 716 | 716 | */ |
| 717 | 717 | protected function createByPregSelector($regex) |
| 718 | 718 | { |
| 719 | - return function ($key, $value) use ($regex) { |
|
| 719 | + return function($key, $value) use ($regex) { |
|
| 720 | 720 | return preg_match($regex, $key) |
| 721 | 721 | ? self::SELECT_FILTER_PASS |
| 722 | 722 | : self::SELECT_FILTER_REFUSE; |
@@ -743,7 +743,7 @@ discard block |
||
| 743 | 743 | $selectFilter = $this->createByIndexSelector($options[PCLZIP_OPT_BY_INDEX]); |
| 744 | 744 | // no rule |
| 745 | 745 | else |
| 746 | - $selectFilter = function () { |
|
| 746 | + $selectFilter = function() { |
|
| 747 | 747 | return self::SELECT_FILTER_PASS; |
| 748 | 748 | }; |
| 749 | 749 | return $selectFilter; |
@@ -783,9 +783,9 @@ discard block |
||
| 783 | 783 | if (isset($options[PCLZIP_OPT_COMMENT])) |
| 784 | 784 | $comment = $options[PCLZIP_OPT_COMMENT]; |
| 785 | 785 | else if (isset($options[PCLZIP_OPT_ADD_COMMENT])) {; |
| 786 | - $comment = $currentComment . $options[PCLZIP_OPT_ADD_COMMENT]; |
|
| 786 | + $comment = $currentComment.$options[PCLZIP_OPT_ADD_COMMENT]; |
|
| 787 | 787 | } else if (isset($options[PCLZIP_OPT_PREPEND_COMMENT])) { |
| 788 | - $comment = $options[PCLZIP_OPT_PREPEND_COMMENT] . $currentComment; |
|
| 788 | + $comment = $options[PCLZIP_OPT_PREPEND_COMMENT].$currentComment; |
|
| 789 | 789 | } |
| 790 | 790 | return $comment; |
| 791 | 791 | } |
@@ -142,8 +142,11 @@ discard block |
||
| 142 | 142 | */ |
| 143 | 143 | public function create($content) |
| 144 | 144 | { |
| 145 | - if (is_array($content)) $paths_list = $content; |
|
| 146 | - else $paths_list = explode(',', $content); |
|
| 145 | + if (is_array($content)) { |
|
| 146 | + $paths_list = $content; |
|
| 147 | + } else { |
|
| 148 | + $paths_list = explode(',', $content); |
|
| 149 | + } |
|
| 147 | 150 | |
| 148 | 151 | $options = $this->makeOptionsFromArguments(func_get_args()); |
| 149 | 152 | |
@@ -151,8 +154,9 @@ discard block |
||
| 151 | 154 | $filters = $this->createFilters($options); |
| 152 | 155 | list($preAddCallback, $postAddCallback) = $this->extractCallbacks($options, PCLZIP_CB_PRE_ADD, PCLZIP_CB_POST_ADD); |
| 153 | 156 | |
| 154 | - if (!empty($comment = $this->buildComment($options, null))) |
|
| 155 | - $this->archive->setComment($comment); |
|
| 157 | + if (!empty($comment = $this->buildComment($options, null))) { |
|
| 158 | + $this->archive->setComment($comment); |
|
| 159 | + } |
|
| 156 | 160 | |
| 157 | 161 | // scan filesystem for files list |
| 158 | 162 | return $this->addSnippets($paths_list, $filters, $preAddCallback, $postAddCallback); |
@@ -172,16 +176,18 @@ discard block |
||
| 172 | 176 | $localname = $fileToAdd; |
| 173 | 177 | $filename = $fileToAdd; |
| 174 | 178 | |
| 175 | - foreach ($filters as $filter) |
|
| 176 | - call_user_func($filter, $localname, $filename); |
|
| 179 | + foreach ($filters as $filter) { |
|
| 180 | + call_user_func($filter, $localname, $filename); |
|
| 181 | + } |
|
| 177 | 182 | |
| 178 | 183 | $file_header = $this->createFileHeader($localname, $filename); |
| 179 | 184 | if (call_user_func($preAddCallback, $file_header) == 1) { |
| 180 | 185 | // |
| 181 | 186 | // Check for max length > 255 |
| 182 | 187 | // |
| 183 | - if (strlen(basename($file_header->stored_filename)) > 255) |
|
| 184 | - $file_header->status = 'filename_too_long'; |
|
| 188 | + if (strlen(basename($file_header->stored_filename)) > 255) { |
|
| 189 | + $file_header->status = 'filename_too_long'; |
|
| 190 | + } |
|
| 185 | 191 | if (is_file($filename)) { |
| 186 | 192 | $this->archive->add([ |
| 187 | 193 | $file_header->stored_filename => $file_header->filename, |
@@ -253,27 +259,35 @@ discard block |
||
| 253 | 259 | } |
| 254 | 260 | |
| 255 | 261 | // filters initiation |
| 256 | - if (isset($options[PCLZIP_OPT_PATH])) |
|
| 257 | - $extractPath = rtrim($options[PCLZIP_OPT_PATH], '/'); |
|
| 258 | - else $extractPath = rtrim(getcwd(), '/'); |
|
| 262 | + if (isset($options[PCLZIP_OPT_PATH])) { |
|
| 263 | + $extractPath = rtrim($options[PCLZIP_OPT_PATH], '/'); |
|
| 264 | + } else { |
|
| 265 | + $extractPath = rtrim(getcwd(), '/'); |
|
| 266 | + } |
|
| 259 | 267 | |
| 260 | 268 | $filters = $this->createFilters($options); |
| 261 | 269 | list($preExtractCallback, $postExtractCallback) = $this->extractCallbacks($options, PCLZIP_CB_PRE_EXTRACT, PCLZIP_CB_POST_EXTRACT); |
| 262 | 270 | $selectFilter = $this->createSelector($options); |
| 263 | 271 | |
| 264 | - if (isset($options[PCLZIP_OPT_EXTRACT_AS_STRING])) |
|
| 265 | - $anotherOutputFormat = PCLZIP_OPT_EXTRACT_AS_STRING; |
|
| 266 | - else if (isset($options[PCLZIP_OPT_EXTRACT_IN_OUTPUT])) |
|
| 267 | - $anotherOutputFormat = PCLZIP_OPT_EXTRACT_IN_OUTPUT; |
|
| 268 | - else $anotherOutputFormat = false; |
|
| 272 | + if (isset($options[PCLZIP_OPT_EXTRACT_AS_STRING])) { |
|
| 273 | + $anotherOutputFormat = PCLZIP_OPT_EXTRACT_AS_STRING; |
|
| 274 | + } else if (isset($options[PCLZIP_OPT_EXTRACT_IN_OUTPUT])) { |
|
| 275 | + $anotherOutputFormat = PCLZIP_OPT_EXTRACT_IN_OUTPUT; |
|
| 276 | + } else { |
|
| 277 | + $anotherOutputFormat = false; |
|
| 278 | + } |
|
| 269 | 279 | |
| 270 | - if (isset($options[PCLZIP_OPT_REPLACE_NEWER])) |
|
| 271 | - $doNotReplaceNewer = false; |
|
| 272 | - else $doNotReplaceNewer = true; |
|
| 280 | + if (isset($options[PCLZIP_OPT_REPLACE_NEWER])) { |
|
| 281 | + $doNotReplaceNewer = false; |
|
| 282 | + } else { |
|
| 283 | + $doNotReplaceNewer = true; |
|
| 284 | + } |
|
| 273 | 285 | |
| 274 | - if (isset($options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION])) |
|
| 275 | - $restrictExtractDir = $options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION]; |
|
| 276 | - else $restrictExtractDir = false; |
|
| 286 | + if (isset($options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION])) { |
|
| 287 | + $restrictExtractDir = $options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION]; |
|
| 288 | + } else { |
|
| 289 | + $restrictExtractDir = false; |
|
| 290 | + } |
|
| 277 | 291 | |
| 278 | 292 | $report = array(); |
| 279 | 293 | foreach ($this->listContent() as $file_header) { |
@@ -344,8 +358,10 @@ discard block |
||
| 344 | 358 | // extract content |
| 345 | 359 | else if ($anotherOutputFormat === false) { |
| 346 | 360 | // apply path filters |
| 347 | - foreach ($filters as $filter) call_user_func($filter, |
|
| 361 | + foreach ($filters as $filter) { |
|
| 362 | + call_user_func($filter, |
|
| 348 | 363 | $file_header->stored_filename, $file_header->filename); |
| 364 | + } |
|
| 349 | 365 | // dir extraction process |
| 350 | 366 | if ($file_header->folder) { |
| 351 | 367 | // if dir doesn't exist |
@@ -436,15 +452,19 @@ discard block |
||
| 436 | 452 | */ |
| 437 | 453 | public function add($content) |
| 438 | 454 | { |
| 439 | - if (is_array($content)) $paths_list = $content; |
|
| 440 | - else $paths_list = explode(',', $content); |
|
| 455 | + if (is_array($content)) { |
|
| 456 | + $paths_list = $content; |
|
| 457 | + } else { |
|
| 458 | + $paths_list = explode(',', $content); |
|
| 459 | + } |
|
| 441 | 460 | |
| 442 | 461 | $options = $this->makeOptionsFromArguments(func_get_args()); |
| 443 | 462 | $filters = $this->createFilters($options); |
| 444 | 463 | list($preAddCallback, $postAddCallback) = $this->extractCallbacks($options, PCLZIP_CB_PRE_ADD, PCLZIP_CB_POST_ADD); |
| 445 | 464 | |
| 446 | - if (!empty($comment = $this->buildComment($options, $this->archive->getComment()))) |
|
| 447 | - $this->archive->setComment($comment); |
|
| 465 | + if (!empty($comment = $this->buildComment($options, $this->archive->getComment()))) { |
|
| 466 | + $this->archive->setComment($comment); |
|
| 467 | + } |
|
| 448 | 468 | |
| 449 | 469 | // scan filesystem for files list |
| 450 | 470 | return $this->addSnippets($paths_list, $filters, $preAddCallback, $postAddCallback); |
@@ -516,8 +536,12 @@ discard block |
||
| 516 | 536 | } |
| 517 | 537 | |
| 518 | 538 | $tempDir = tempnam(PCLZIP_TEMPORARY_DIR, 'merging'); |
| 519 | - if (file_exists($tempDir)) unlink($tempDir); |
|
| 520 | - if (!mkdir($tempDir)) return 0; |
|
| 539 | + if (file_exists($tempDir)) { |
|
| 540 | + unlink($tempDir); |
|
| 541 | + } |
|
| 542 | + if (!mkdir($tempDir)) { |
|
| 543 | + return 0; |
|
| 544 | + } |
|
| 521 | 545 | |
| 522 | 546 | // go through archive content list and copy all files |
| 523 | 547 | foreach ($a->getFiles() as $filename) { |
@@ -546,8 +570,11 @@ discard block |
||
| 546 | 570 | |
| 547 | 571 | call_user_func(function ($directory) { |
| 548 | 572 | foreach (glob($directory.'/*') as $f) { |
| 549 | - if (is_dir($f)) call_user_func(__FUNCTION__, $f); |
|
| 550 | - else unlink($f); |
|
| 573 | + if (is_dir($f)) { |
|
| 574 | + call_user_func(__FUNCTION__, $f); |
|
| 575 | + } else { |
|
| 576 | + unlink($f); |
|
| 577 | + } |
|
| 551 | 578 | } |
| 552 | 579 | }, $tempDir); |
| 553 | 580 | |
@@ -572,18 +599,21 @@ discard block |
||
| 572 | 599 | { |
| 573 | 600 | $filters = array(); |
| 574 | 601 | if (isset($options[PCLZIP_OPT_REMOVE_PATH]) |
| 575 | - && !isset($options[PCLZIP_OPT_REMOVE_ALL_PATH])) |
|
| 576 | - $filters[] = function (&$key, &$value) use ($options) { |
|
| 602 | + && !isset($options[PCLZIP_OPT_REMOVE_ALL_PATH])) { |
|
| 603 | + $filters[] = function (&$key, &$value) use ($options) { |
|
| 577 | 604 | $key = str_replace($key, null, $key); |
| 605 | + } |
|
| 578 | 606 | }; |
| 579 | - if (isset($options[PCLZIP_OPT_REMOVE_ALL_PATH])) |
|
| 580 | - $filters[] = function (&$key, &$value) { |
|
| 607 | + if (isset($options[PCLZIP_OPT_REMOVE_ALL_PATH])) { |
|
| 608 | + $filters[] = function (&$key, &$value) { |
|
| 581 | 609 | $key = basename($key); |
| 610 | + } |
|
| 582 | 611 | }; |
| 583 | - if (isset($options[PCLZIP_OPT_ADD_PATH])) |
|
| 584 | - $filters[] = function (&$key, &$value) use ($options) { |
|
| 612 | + if (isset($options[PCLZIP_OPT_ADD_PATH])) { |
|
| 613 | + $filters[] = function (&$key, &$value) use ($options) { |
|
| 585 | 614 | $key = rtrim($options[PCLZIP_OPT_ADD_PATH], '/') . '/' . |
| 586 | 615 | ltrim($key, '/'); |
| 616 | + } |
|
| 587 | 617 | }; |
| 588 | 618 | return $filters; |
| 589 | 619 | } |
@@ -598,11 +628,13 @@ discard block |
||
| 598 | 628 | { |
| 599 | 629 | $preCallback = $postCallback = function () { return true; }; |
| 600 | 630 | |
| 601 | - if (isset($options[$preCallbackConst]) && is_callable($options[$preCallbackConst])) |
|
| 602 | - $preCallback = $options[$preCallbackConst]; |
|
| 631 | + if (isset($options[$preCallbackConst]) && is_callable($options[$preCallbackConst])) { |
|
| 632 | + $preCallback = $options[$preCallbackConst]; |
|
| 633 | + } |
|
| 603 | 634 | |
| 604 | - if (isset($options[$postCallbackConst]) && is_callable($options[$postCallbackConst])) |
|
| 605 | - $postCallback = $options[$postCallbackConst]; |
|
| 635 | + if (isset($options[$postCallbackConst]) && is_callable($options[$postCallbackConst])) { |
|
| 636 | + $postCallback = $options[$postCallbackConst]; |
|
| 637 | + } |
|
| 606 | 638 | |
| 607 | 639 | return [$preCallback, $postCallback]; |
| 608 | 640 | } |
@@ -615,7 +647,9 @@ discard block |
||
| 615 | 647 | { |
| 616 | 648 | $keys = array_filter($options, function ($v) {return ($v%2) == 0;}, ARRAY_FILTER_USE_KEY); |
| 617 | 649 | $values = array_filter($options, function ($v) {return ($v%2) == 1;}, ARRAY_FILTER_USE_KEY); |
| 618 | - if (count($values) < count($keys)) $values[] = true; |
|
| 650 | + if (count($values) < count($keys)) { |
|
| 651 | + $values[] = true; |
|
| 652 | + } |
|
| 619 | 653 | return array_combine($keys, $values); |
| 620 | 654 | } |
| 621 | 655 | |
@@ -658,9 +692,12 @@ discard block |
||
| 658 | 692 | $allowedIndexes = array(); |
| 659 | 693 | foreach ($indexes as $rule) { |
| 660 | 694 | $parts = explode('-', $rule); |
| 661 | - if (count($parts) == 1) $allowedIndexes[] = $rule; |
|
| 662 | - else $allowedIndexes = array_merge( |
|
| 695 | + if (count($parts) == 1) { |
|
| 696 | + $allowedIndexes[] = $rule; |
|
| 697 | + } else { |
|
| 698 | + $allowedIndexes = array_merge( |
|
| 663 | 699 | range($parts[0], $parts[1]), $allowedIndexes); |
| 700 | + } |
|
| 664 | 701 | } |
| 665 | 702 | |
| 666 | 703 | return function ($key, $value, $index) use ($allowedIndexes) { |
@@ -735,21 +772,26 @@ discard block |
||
| 735 | 772 | protected function createSelector(array $options) |
| 736 | 773 | { |
| 737 | 774 | // exact matching |
| 738 | - if (isset($options[PCLZIP_OPT_BY_NAME])) |
|
| 739 | - $selectFilter = $this->createByNameSelector($options[PCLZIP_OPT_BY_NAME]); |
|
| 775 | + if (isset($options[PCLZIP_OPT_BY_NAME])) { |
|
| 776 | + $selectFilter = $this->createByNameSelector($options[PCLZIP_OPT_BY_NAME]); |
|
| 777 | + } |
|
| 740 | 778 | // <ereg> rule |
| 741 | - else if (isset($options[PCLZIP_OPT_BY_EREG]) && function_exists('ereg')) |
|
| 742 | - $selectFilter = $this->createByEregSelector($options[PCLZIP_OPT_BY_EREG]); |
|
| 779 | + else if (isset($options[PCLZIP_OPT_BY_EREG]) && function_exists('ereg')) { |
|
| 780 | + $selectFilter = $this->createByEregSelector($options[PCLZIP_OPT_BY_EREG]); |
|
| 781 | + } |
|
| 743 | 782 | // <preg_match> rule |
| 744 | - else if (isset($options[PCLZIP_OPT_BY_PREG])) |
|
| 745 | - $selectFilter = $this->createByPregSelector($options[PCLZIP_OPT_BY_PREG]); |
|
| 783 | + else if (isset($options[PCLZIP_OPT_BY_PREG])) { |
|
| 784 | + $selectFilter = $this->createByPregSelector($options[PCLZIP_OPT_BY_PREG]); |
|
| 785 | + } |
|
| 746 | 786 | // index rule |
| 747 | - else if (isset($options[PCLZIP_OPT_BY_INDEX])) |
|
| 748 | - $selectFilter = $this->createByIndexSelector($options[PCLZIP_OPT_BY_INDEX]); |
|
| 787 | + else if (isset($options[PCLZIP_OPT_BY_INDEX])) { |
|
| 788 | + $selectFilter = $this->createByIndexSelector($options[PCLZIP_OPT_BY_INDEX]); |
|
| 789 | + } |
|
| 749 | 790 | // no rule |
| 750 | - else |
|
| 751 | - $selectFilter = function () { |
|
| 791 | + else { |
|
| 792 | + $selectFilter = function () { |
|
| 752 | 793 | return self::SELECT_FILTER_PASS; |
| 794 | + } |
|
| 753 | 795 | }; |
| 754 | 796 | return $selectFilter; |
| 755 | 797 | } |
@@ -785,9 +827,9 @@ discard block |
||
| 785 | 827 | protected function buildComment(array $options, $currentComment) |
| 786 | 828 | { |
| 787 | 829 | $comment = null; |
| 788 | - if (isset($options[PCLZIP_OPT_COMMENT])) |
|
| 789 | - $comment = $options[PCLZIP_OPT_COMMENT]; |
|
| 790 | - else if (isset($options[PCLZIP_OPT_ADD_COMMENT])) {; |
|
| 830 | + if (isset($options[PCLZIP_OPT_COMMENT])) { |
|
| 831 | + $comment = $options[PCLZIP_OPT_COMMENT]; |
|
| 832 | + } else if (isset($options[PCLZIP_OPT_ADD_COMMENT])) {; |
|
| 791 | 833 | $comment = $currentComment . $options[PCLZIP_OPT_ADD_COMMENT]; |
| 792 | 834 | } else if (isset($options[PCLZIP_OPT_PREPEND_COMMENT])) { |
| 793 | 835 | $comment = $options[PCLZIP_OPT_PREPEND_COMMENT] . $currentComment; |
@@ -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 | /** |
@@ -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; |