@@ -237,8 +237,8 @@ |
||
| 237 | 237 | if ($code == 0 || $code == 2 || is_null($code)) { |
| 238 | 238 | // rewrite original file |
| 239 | 239 | if (rename($this->tmp2, $this->path) !== true) { |
| 240 | - throw new \RuntimeException(__FILE__ . ', line ' . __LINE__ . |
|
| 241 | - ': Could not replace original file ' . $this->path); |
|
| 240 | + throw new \RuntimeException(__FILE__.', line '.__LINE__. |
|
| 241 | + ': Could not replace original file '.$this->path); |
|
| 242 | 242 | } |
| 243 | 243 | } else { |
| 244 | 244 | throw new \RuntimeException(__FILE__.', line '.__LINE__. |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | { |
| 16 | 16 | $fp = fopen($file, 'rb'); |
| 17 | 17 | if (filesize($file) < 18 || strcmp(fread($fp, 2), "\x1f\x8b")) { |
| 18 | - return false; // Not GZIP format (See RFC 1952) |
|
| 18 | + return false; // Not GZIP format (See RFC 1952) |
|
| 19 | 19 | } |
| 20 | 20 | $method = fread($fp, 1); |
| 21 | 21 | $flags = fread($fp, 1); |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | if (!empty($previous_comment = $archive->getComment())) { |
| 32 | - $output->writeln('Comment "' . $previous_comment . '" replaced', OutputInterface::OUTPUT_RAW); |
|
| 32 | + $output->writeln('Comment "'.$previous_comment.'" replaced', OutputInterface::OUTPUT_RAW); |
|
| 33 | 33 | } else if ($comment === null) { |
| 34 | 34 | $output->writeln('Comment deleted', OutputInterface::OUTPUT_RAW); |
| 35 | 35 | } else { |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | if (empty($destination)) { |
| 49 | 49 | throw new \LogicException('Source and destination can not be empty'); |
| 50 | 50 | } |
| 51 | - $output->writeln('<info>Read ' . $data_size . ' from input</info>'); |
|
| 51 | + $output->writeln('<info>Read '.$data_size.' from input</info>'); |
|
| 52 | 52 | } else { |
| 53 | 53 | $data_size = filesize($source); |
| 54 | 54 | } |
@@ -75,9 +75,9 @@ discard block |
||
| 75 | 75 | } |
| 76 | 76 | if ($added_files === 1) { |
| 77 | 77 | $details = $archive->getFileData($destination); |
| 78 | - $output->writeln('Added <comment>' . $source . '</comment>(' |
|
| 79 | - . implode($this->formatSize($data_size)) . ') as ' |
|
| 80 | - . $destination . ' (' |
|
| 78 | + $output->writeln('Added <comment>'.$source.'</comment>(' |
|
| 79 | + . implode($this->formatSize($data_size)).') as ' |
|
| 80 | + . $destination.' (' |
|
| 81 | 81 | . implode($this->formatSize($details->compressedSize)) |
| 82 | 82 | . ')'); |
| 83 | 83 | } |
@@ -31,18 +31,18 @@ |
||
| 31 | 31 | $detect_mimetype = $input->getOption('detect-mimetype'); |
| 32 | 32 | |
| 33 | 33 | $details = $archive->getFileData($file); |
| 34 | - $output->writeln('File <info>' . $file . '</info>'); |
|
| 34 | + $output->writeln('File <info>'.$file.'</info>'); |
|
| 35 | 35 | if ($detect_mimetype) { |
| 36 | - $output->writeln('Mime type: <info>' . $this->getMimeTypeByStream($archive->getFileStream($file)).'</info>'); |
|
| 36 | + $output->writeln('Mime type: <info>'.$this->getMimeTypeByStream($archive->getFileStream($file)).'</info>'); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | $output->writeln('Size:'); |
| 40 | - $output->writeln("\t". 'uncompressed: '.implode(' ', $this->formatSize($details->uncompressedSize, 2))); |
|
| 41 | - $output->writeln("\t" . 'compressed: ' . implode(' ', $this->formatSize($details->compressedSize, 2))); |
|
| 42 | - $output->writeln("\t" . 'ratio: <info>' . round($details->uncompressedSize / $details->compressedSize, 6) . '/1 (' . floor($details->compressedSize / $details->uncompressedSize * 100) . '%</info>)'); |
|
| 43 | - $output->writeln('Modificated: ' . $this->formatDate($details->modificationTime)); |
|
| 40 | + $output->writeln("\t".'uncompressed: '.implode(' ', $this->formatSize($details->uncompressedSize, 2))); |
|
| 41 | + $output->writeln("\t".'compressed: '.implode(' ', $this->formatSize($details->compressedSize, 2))); |
|
| 42 | + $output->writeln("\t".'ratio: <info>'.round($details->uncompressedSize / $details->compressedSize, 6).'/1 ('.floor($details->compressedSize / $details->uncompressedSize * 100).'%</info>)'); |
|
| 43 | + $output->writeln('Modificated: '.$this->formatDate($details->modificationTime)); |
|
| 44 | 44 | if (!empty($comment = $details->comment)) |
| 45 | - $output->writeln('Comment: <comment>' . $comment . '</comment>'); |
|
| 45 | + $output->writeln('Comment: <comment>'.$comment.'</comment>'); |
|
| 46 | 46 | |
| 47 | 47 | if (empty($input->getArgument('file'))) { |
| 48 | 48 | $helper = $this->getHelper('question'); |
@@ -88,7 +88,7 @@ |
||
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | if ($sort !== null) { |
| 91 | - usort($rows, function (array $a, array $b) use ($sort_field) { |
|
| 91 | + usort($rows, function(array $a, array $b) use ($sort_field) { |
|
| 92 | 92 | if ($a[$sort_field] > $b[$sort_field]) { |
| 93 | 93 | return 1; |
| 94 | 94 | } |
@@ -37,9 +37,9 @@ |
||
| 37 | 37 | $question = new ChoiceQuestion('Which file', $files); |
| 38 | 38 | $file = $helper->ask($input, $output, $question); |
| 39 | 39 | } else if (!in_array($file, $files, true)) { |
| 40 | - throw new \InvalidArgumentException('File "' . $file . '" not found in archive'); |
|
| 40 | + throw new \InvalidArgumentException('File "'.$file.'" not found in archive'); |
|
| 41 | 41 | } |
| 42 | - $output->writeln('<comment>Selecting file ' . $file . '</comment>', OutputInterface::VERBOSITY_VERY_VERBOSE); |
|
| 42 | + $output->writeln('<comment>Selecting file '.$file.'</comment>', OutputInterface::VERBOSITY_VERY_VERBOSE); |
|
| 43 | 43 | |
| 44 | 44 | return [$archive, $file]; |
| 45 | 45 | } |
@@ -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 | |
@@ -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 | } |