@@ -31,7 +31,7 @@ |
||
31 | 31 | |
32 | 32 | public static function getInstallationInstruction() |
33 | 33 | { |
34 | - return 'install `' . static::PHP_EXTENSION . '` extension'; |
|
34 | + return 'install `'.static::PHP_EXTENSION.'` extension'; |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | public static function getSupportedFormats() |
@@ -59,10 +59,12 @@ discard block |
||
59 | 59 | */ |
60 | 60 | public function __construct($archiveFileName, $format, $password = null) |
61 | 61 | { |
62 | - if (static::FORMAT_SUFFIX === null) |
|
63 | - throw new \Exception('Format should be initialized'); |
|
64 | - if ($password !== null) |
|
65 | - throw new UnsupportedOperationException(self::FORMAT_SUFFIX.' archive does not support password!'); |
|
62 | + if (static::FORMAT_SUFFIX === null) { |
|
63 | + throw new \Exception('Format should be initialized'); |
|
64 | + } |
|
65 | + if ($password !== null) { |
|
66 | + throw new UnsupportedOperationException(self::FORMAT_SUFFIX.' archive does not support password!'); |
|
67 | + } |
|
66 | 68 | |
67 | 69 | parent::__construct($archiveFileName, $format); |
68 | 70 | |
@@ -131,8 +133,9 @@ discard block |
||
131 | 133 | public function extractArchive($outputFolder) |
132 | 134 | { |
133 | 135 | $data = $this->getFileContent($this->inArchiveFileName); |
134 | - if ($data === false) |
|
135 | - throw new ArchiveExtractionException('Could not extract archive'); |
|
136 | + if ($data === false) { |
|
137 | + throw new ArchiveExtractionException('Could not extract archive'); |
|
138 | + } |
|
136 | 139 | |
137 | 140 | $size = strlen($data); |
138 | 141 | $written = file_put_contents($outputFolder.$this->inArchiveFileName, $data); |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | */ |
14 | 14 | class Lzma extends OneFileDriver |
15 | 15 | { |
16 | - const FORMAT_SUFFIX = 'xz'; |
|
16 | + const FORMAT_SUFFIX = 'xz'; |
|
17 | 17 | const PHP_EXTENSION = 'xz'; |
18 | 18 | const FORMAT = Formats::LZMA; |
19 | 19 | |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | */ |
31 | 31 | public static function getInstallationInstruction() |
32 | 32 | { |
33 | - return 'install [xz] extension' . "\n" . 'For 5.x: https://github.com/payden/php-xz' . "\n" . 'For 7.x/8.x: https://github.com/codemasher/php-ext-xz'; |
|
33 | + return 'install [xz] extension'."\n".'For 5.x: https://github.com/payden/php-xz'."\n".'For 7.x/8.x: https://github.com/codemasher/php-ext-xz'; |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
@@ -82,8 +82,9 @@ |
||
82 | 82 | public function __construct($archiveFileName, $format, $password = null) |
83 | 83 | { |
84 | 84 | parent::__construct($archiveFileName, $format); |
85 | - if ($password !== null) |
|
86 | - throw new UnsupportedOperationException('Cab archive does not support password!'); |
|
85 | + if ($password !== null) { |
|
86 | + throw new UnsupportedOperationException('Cab archive does not support password!'); |
|
87 | + } |
|
87 | 88 | $this->open($archiveFileName); |
88 | 89 | } |
89 | 90 |
@@ -27,7 +27,7 @@ |
||
27 | 27 | |
28 | 28 | $errored = []; |
29 | 29 | foreach ($files as $file) { |
30 | - $output->write($file . ' ... '); |
|
30 | + $output->write($file.' ... '); |
|
31 | 31 | if ($archive->test($file) === true) { |
32 | 32 | $output->writeln('<info>ok</info>'); |
33 | 33 | } else { |
@@ -27,15 +27,15 @@ |
||
27 | 27 | $file = realpath($input->getArgument('archive')); |
28 | 28 | $archive = $this->getArchive($input, $output); |
29 | 29 | |
30 | - $output->writeln('Filename: ' . $file . ' (changed <comment>' . $this->formatDate(filemtime($file)) . '</comment>)'); |
|
31 | - $output->writeln('Type: <info>' . $archive->getFormat() . '</info>, mime <info>' . $archive->getMimeType() . '</info> (via driver <comment>' . $archive->getDriverType() . '</comment>)'); |
|
32 | - $output->writeln('Contains: ' . $archive->countFiles() . ' file' . ($archive->countFiles() > 1 ? 's' : null)); |
|
30 | + $output->writeln('Filename: '.$file.' (changed <comment>'.$this->formatDate(filemtime($file)).'</comment>)'); |
|
31 | + $output->writeln('Type: <info>'.$archive->getFormat().'</info>, mime <info>'.$archive->getMimeType().'</info> (via driver <comment>'.$archive->getDriverType().'</comment>)'); |
|
32 | + $output->writeln('Contains: '.$archive->countFiles().' file'.($archive->countFiles() > 1 ? 's' : null)); |
|
33 | 33 | $output->writeln('Size:'); |
34 | - $output->writeln("\t". 'uncompressed: '.implode(' ', $this->formatSize($archive->getOriginalSize(), 2))); |
|
35 | - $output->writeln("\t" . 'compressed: ' . implode(' ', $this->formatSize($archive->getCompressedSize(), 2))); |
|
36 | - $output->writeln("\t" . 'ratio: <info>' . round($archive->getOriginalSize() / $archive->getCompressedSize(), 6) . '/1 (' . floor($archive->getCompressedSize() / $archive->getOriginalSize() * 100) . '%</info>)'); |
|
34 | + $output->writeln("\t".'uncompressed: '.implode(' ', $this->formatSize($archive->getOriginalSize(), 2))); |
|
35 | + $output->writeln("\t".'compressed: '.implode(' ', $this->formatSize($archive->getCompressedSize(), 2))); |
|
36 | + $output->writeln("\t".'ratio: <info>'.round($archive->getOriginalSize() / $archive->getCompressedSize(), 6).'/1 ('.floor($archive->getCompressedSize() / $archive->getOriginalSize() * 100).'%</info>)'); |
|
37 | 37 | if ($archive->getDriver()->checkAbility(BasicDriver::GET_COMMENT) && !empty($comment = $archive->getComment())) |
38 | - $output->writeln('Comment: <comment>' . $comment . '</comment>'); |
|
38 | + $output->writeln('Comment: <comment>'.$comment.'</comment>'); |
|
39 | 39 | |
40 | 40 | return 0; |
41 | 41 | } |
@@ -34,8 +34,9 @@ |
||
34 | 34 | $output->writeln("\t". 'uncompressed: '.implode(' ', $this->formatSize($archive->getOriginalSize(), 2))); |
35 | 35 | $output->writeln("\t" . 'compressed: ' . implode(' ', $this->formatSize($archive->getCompressedSize(), 2))); |
36 | 36 | $output->writeln("\t" . 'ratio: <info>' . round($archive->getOriginalSize() / $archive->getCompressedSize(), 6) . '/1 (' . floor($archive->getCompressedSize() / $archive->getOriginalSize() * 100) . '%</info>)'); |
37 | - if ($archive->getDriver()->checkAbility(BasicDriver::GET_COMMENT) && !empty($comment = $archive->getComment())) |
|
38 | - $output->writeln('Comment: <comment>' . $comment . '</comment>'); |
|
37 | + if ($archive->getDriver()->checkAbility(BasicDriver::GET_COMMENT) && !empty($comment = $archive->getComment())) { |
|
38 | + $output->writeln('Comment: <comment>' . $comment . '</comment>'); |
|
39 | + } |
|
39 | 40 | |
40 | 41 | return 0; |
41 | 42 | } |
@@ -33,9 +33,9 @@ discard block |
||
33 | 33 | if ($driver !== null) { |
34 | 34 | $driver = $this->resolveDriverName($driver); |
35 | 35 | if (!class_exists($driver) || !is_a($driver, BasicDriver::class, true)) { |
36 | - throw new \InvalidArgumentException('Class "' . $driver . '" not found or not in BasicDriver children'); |
|
36 | + throw new \InvalidArgumentException('Class "'.$driver.'" not found or not in BasicDriver children'); |
|
37 | 37 | } |
38 | - $output->writeln('Supported formats by <info>' . $driver . '</info>'); |
|
38 | + $output->writeln('Supported formats by <info>'.$driver.'</info>'); |
|
39 | 39 | |
40 | 40 | $table->setHeaders(['format', ...array_keys(self::$abilitiesLabels)]); |
41 | 41 | foreach ($driver::getSupportedFormats() as $i => $format) { |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | $table->render(); |
87 | 87 | |
88 | 88 | foreach (array_combine(array_values(self::$abilitiesShortCuts), array_keys(self::$abilitiesLabels)) as $shortCut => $label) { |
89 | - $output->writeln('<info>' . $shortCut . '</info> - ' . $label); |
|
89 | + $output->writeln('<info>'.$shortCut.'</info> - '.$label); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | return 0; |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | if ($typeDriverConfig[1]) { |
64 | 64 | // $type_messages[] = '<info>' . $typeDriverClass . '</info>: ' . $typeDriverConfig[0]; |
65 | 65 | $table->setRow($i++, [ |
66 | - '<info>' . $this->getDriverBaseName($typeDriverClass) . '</info>', |
|
66 | + '<info>'.$this->getDriverBaseName($typeDriverClass).'</info>', |
|
67 | 67 | BasicDriver::$typeLabels[$typeDriverClass::TYPE], |
68 | 68 | $typeDriverConfig[0], |
69 | 69 | ]); |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | // $type_messages[] = '<error>' . $typeDriverClass . '</error>: ' . $typeDriverConfig[0]; |
72 | 72 | // $type_messages[] = $this->formatInstallation($typeDriverConfig[2], 4); |
73 | 73 | $table->setRow($i++, [ |
74 | - '<comment>' . $this->getDriverBaseName($typeDriverClass) . '</comment>', |
|
74 | + '<comment>'.$this->getDriverBaseName($typeDriverClass).'</comment>', |
|
75 | 75 | BasicDriver::$typeLabels[$typeDriverClass::TYPE], |
76 | 76 | $this->formatInstallation($typeDriverConfig[2], 0), |
77 | 77 | ]); |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | protected function formatInstallation($doc, $leftPadding = 4) |
95 | 95 | { |
96 | 96 | return implode("\n", array_map( |
97 | - function($line) use ($leftPadding) { return str_repeat(' ', $leftPadding) . $line; }, |
|
97 | + function($line) use ($leftPadding) { return str_repeat(' ', $leftPadding).$line; }, |
|
98 | 98 | explode( |
99 | 99 | "\n", |
100 | 100 | preg_replace('~`(.+?)`~', '<options=bold,underscore>$1</>', $doc) |