@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | */ |
| 54 | 54 | public static function getInstallationInstruction() |
| 55 | 55 | { |
| 56 | - return 'install library [pear/archive_tar]: `composer require pear/archive_tar`' . "\n" . ' and optionally php-extensions (zlib, bz2)'; |
|
| 56 | + return 'install library [pear/archive_tar]: `composer require pear/archive_tar`'."\n".' and optionally php-extensions (zlib, bz2)'; |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | /** |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | $compression = 'lzma2'; |
| 161 | 161 | break; |
| 162 | 162 | case 'z': |
| 163 | - $tar_aname = 'compress.lzw://' . $archiveFileName; |
|
| 163 | + $tar_aname = 'compress.lzw://'.$archiveFileName; |
|
| 164 | 164 | break; |
| 165 | 165 | } |
| 166 | 166 | |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | |
| 218 | 218 | case Formats::TAR_LZW: |
| 219 | 219 | LzwStreamWrapper::registerWrapper(); |
| 220 | - $this->tar = new Archive_Tar('compress.lzw://' . $this->fileName); |
|
| 220 | + $this->tar = new Archive_Tar('compress.lzw://'.$this->fileName); |
|
| 221 | 221 | break; |
| 222 | 222 | |
| 223 | 223 | default: |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | $result = $this->tar->extractList($files, $outputFolder); |
| 336 | 336 | if ($result === false) { |
| 337 | 337 | if (isset($this->tar->error_object)) { |
| 338 | - throw new ArchiveExtractionException('Error when extracting from ' . $this->fileName . ': ' . $this->tar->error_object->getMessage(0)); |
|
| 338 | + throw new ArchiveExtractionException('Error when extracting from '.$this->fileName.': '.$this->tar->error_object->getMessage(0)); |
|
| 339 | 339 | } |
| 340 | 340 | throw new ArchiveExtractionException('Error when extracting from '.$this->fileName); |
| 341 | 341 | } |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | $result = $this->tar->extract($outputFolder); |
| 352 | 352 | if ($result === false) { |
| 353 | 353 | if (isset($this->tar->error_object)) { |
| 354 | - throw new ArchiveExtractionException('Error when extracting ' . $this->fileName . ': ' |
|
| 354 | + throw new ArchiveExtractionException('Error when extracting '.$this->fileName.': ' |
|
| 355 | 355 | . $this->tar->error_object->toString() |
| 356 | 356 | ); |
| 357 | 357 | } |
@@ -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 | /** |
@@ -213,7 +213,7 @@ |
||
| 213 | 213 | */ |
| 214 | 214 | public function getFileStream($fileName) |
| 215 | 215 | { |
| 216 | - return fopen('phar://'.$this->fileName . '/' . $fileName, 'rb'); |
|
| 216 | + return fopen('phar://'.$this->fileName.'/'.$fileName, 'rb'); |
|
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | /** |
@@ -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 | } |
@@ -114,10 +114,10 @@ |
||
| 114 | 114 | protected function resolveDriverName($driver) |
| 115 | 115 | { |
| 116 | 116 | if (strpos($driver, '\\') === false) { |
| 117 | - if (class_exists('\\wapmorgan\\UnifiedArchive\\Drivers\\' . $driver)) { |
|
| 118 | - $driver = '\\wapmorgan\\UnifiedArchive\\Drivers\\' . $driver; |
|
| 119 | - } else if (class_exists('\\wapmorgan\\UnifiedArchive\\Drivers\\OneFile\\' . $driver)) { |
|
| 120 | - $driver = '\\wapmorgan\\UnifiedArchive\\Drivers\\OneFile\\' . $driver; |
|
| 117 | + if (class_exists('\\wapmorgan\\UnifiedArchive\\Drivers\\'.$driver)) { |
|
| 118 | + $driver = '\\wapmorgan\\UnifiedArchive\\Drivers\\'.$driver; |
|
| 119 | + } else if (class_exists('\\wapmorgan\\UnifiedArchive\\Drivers\\OneFile\\'.$driver)) { |
|
| 120 | + $driver = '\\wapmorgan\\UnifiedArchive\\Drivers\\OneFile\\'.$driver; |
|
| 121 | 121 | } |
| 122 | 122 | } |
| 123 | 123 | if ($driver[0] !== '\\') { |
@@ -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) |