@@ -35,13 +35,13 @@ |
||
| 35 | 35 | if (!empty($install)) { |
| 36 | 36 | $notInstalled[] = [$driverClass, $description, $install]; |
| 37 | 37 | } else { |
| 38 | - $output->writeln($formatter->formatSection($driverClass, $description) . ': ' . implode(', ', $driverClass::getSupportedFormats())); |
|
| 38 | + $output->writeln($formatter->formatSection($driverClass, $description).': '.implode(', ', $driverClass::getSupportedFormats())); |
|
| 39 | 39 | } |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | if (!empty($notInstalled)) { |
| 43 | 43 | foreach ($notInstalled as $data) { |
| 44 | - $output->writeln($formatter->formatSection($data[0], $data[1] . ': ' . implode(', ', $data[0]::getSupportedFormats()), 'error')); |
|
| 44 | + $output->writeln($formatter->formatSection($data[0], $data[1].': '.implode(', ', $data[0]::getSupportedFormats()), 'error')); |
|
| 45 | 45 | $data[2] = preg_replace('~`(.+?)`~', '<options=bold,underscore>$1</>', $data[2]); |
| 46 | 46 | $output->writeln($formatter->formatSection($data[0], $data[2], 'comment')); |
| 47 | 47 | } |
@@ -36,9 +36,9 @@ |
||
| 36 | 36 | $driver = '\\'.$driver; |
| 37 | 37 | } |
| 38 | 38 | if (!class_exists($driver) || !is_a($driver, BasicDriver::class, true)) { |
| 39 | - throw new \InvalidArgumentException('Class "' . $driver . '" not found or not in BasicDriver children'); |
|
| 39 | + throw new \InvalidArgumentException('Class "'.$driver.'" not found or not in BasicDriver children'); |
|
| 40 | 40 | } |
| 41 | - $output->writeln('Supported format by <info>' . $driver . '</info>'); |
|
| 41 | + $output->writeln('Supported format by <info>'.$driver.'</info>'); |
|
| 42 | 42 | |
| 43 | 43 | $table->setHeaders(['format', 'stream', 'create', 'append', 'update', 'encrypt']); |
| 44 | 44 | foreach ($driver::getSupportedFormats() as $i => $format) { |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | public static function getInstallationInstruction() |
| 106 | 106 | { |
| 107 | 107 | if (!class_exists('\Archive7z\Archive7z')) |
| 108 | - return 'install library [gemorroj/archive7z]: `composer require gemorroj/archive7z`' . "\n" |
|
| 108 | + return 'install library [gemorroj/archive7z]: `composer require gemorroj/archive7z`'."\n" |
|
| 109 | 109 | . ' and console program p7zip [7za]: `apt install p7zip-full` - depends on OS'; |
| 110 | 110 | |
| 111 | 111 | if (Archive7z::getBinaryVersion() === false) |
@@ -147,8 +147,8 @@ discard block |
||
| 147 | 147 | $information->files[] = $can_get_unix_path |
| 148 | 148 | ? $entry->getUnixPath() |
| 149 | 149 | : str_replace('\\', '/', $entry->getPath()); |
| 150 | - $information->compressedFilesSize += (int)$entry->getPackedSize(); |
|
| 151 | - $information->uncompressedFilesSize += (int)$entry->getSize(); |
|
| 150 | + $information->compressedFilesSize += (int) $entry->getPackedSize(); |
|
| 151 | + $information->uncompressedFilesSize += (int) $entry->getSize(); |
|
| 152 | 152 | } |
| 153 | 153 | return $information; |
| 154 | 154 | } |
@@ -58,12 +58,14 @@ discard block |
||
| 58 | 58 | public static function checkFormatSupport($format) |
| 59 | 59 | { |
| 60 | 60 | $available = class_exists('\Archive7z\Archive7z') && Archive7z::getBinaryVersion() !== false; |
| 61 | - if (!$available) |
|
| 62 | - return false; |
|
| 61 | + if (!$available) { |
|
| 62 | + return false; |
|
| 63 | + } |
|
| 63 | 64 | |
| 64 | 65 | // in 4.0.0 version it was supporting only 7z |
| 65 | - if (!Archive7z::supportsAllFormats()) |
|
| 66 | - return $format === Formats::SEVEN_ZIP; |
|
| 66 | + if (!Archive7z::supportsAllFormats()) { |
|
| 67 | + return $format === Formats::SEVEN_ZIP; |
|
| 68 | + } |
|
| 67 | 69 | |
| 68 | 70 | switch ($format) { |
| 69 | 71 | case Formats::SEVEN_ZIP: |
@@ -104,12 +106,14 @@ discard block |
||
| 104 | 106 | */ |
| 105 | 107 | public static function getInstallationInstruction() |
| 106 | 108 | { |
| 107 | - if (!class_exists('\Archive7z\Archive7z')) |
|
| 108 | - return 'install library [gemorroj/archive7z]: `composer require gemorroj/archive7z`' . "\n" |
|
| 109 | + if (!class_exists('\Archive7z\Archive7z')) { |
|
| 110 | + return 'install library [gemorroj/archive7z]: `composer require gemorroj/archive7z`' . "\n" |
|
| 109 | 111 | . ' and console program p7zip [7za]: `apt install p7zip-full` - depends on OS'; |
| 112 | + } |
|
| 110 | 113 | |
| 111 | - if (Archive7z::getBinaryVersion() === false) |
|
| 112 | - return 'install console program p7zip [7za]: `apt install p7zip-full` - depends on OS'; |
|
| 114 | + if (Archive7z::getBinaryVersion() === false) { |
|
| 115 | + return 'install console program p7zip [7za]: `apt install p7zip-full` - depends on OS'; |
|
| 116 | + } |
|
| 113 | 117 | |
| 114 | 118 | return null; |
| 115 | 119 | } |
@@ -122,8 +126,9 @@ discard block |
||
| 122 | 126 | try { |
| 123 | 127 | $this->format = $format; |
| 124 | 128 | $this->sevenZip = new Archive7z($archiveFileName, null, null); |
| 125 | - if ($password !== null) |
|
| 126 | - $this->sevenZip->setPassword($password); |
|
| 129 | + if ($password !== null) { |
|
| 130 | + $this->sevenZip->setPassword($password); |
|
| 131 | + } |
|
| 127 | 132 | } catch (\Archive7z\Exception $e) { |
| 128 | 133 | throw new Exception('Could not open 7Zip archive: '.$e->getMessage(), $e->getCode(), $e); |
| 129 | 134 | } |
@@ -141,8 +146,9 @@ discard block |
||
| 141 | 146 | continue; |
| 142 | 147 | } |
| 143 | 148 | |
| 144 | - if (!isset($can_get_unix_path)) |
|
| 145 | - $can_get_unix_path = method_exists($entry, 'getUnixPath'); |
|
| 149 | + if (!isset($can_get_unix_path)) { |
|
| 150 | + $can_get_unix_path = method_exists($entry, 'getUnixPath'); |
|
| 151 | + } |
|
| 146 | 152 | |
| 147 | 153 | $information->files[] = $can_get_unix_path |
| 148 | 154 | ? $entry->getUnixPath() |
@@ -160,8 +166,9 @@ discard block |
||
| 160 | 166 | { |
| 161 | 167 | $files = []; |
| 162 | 168 | foreach ($this->sevenZip->getEntries() as $entry) { |
| 163 | - if ($entry->isDirectory()) |
|
| 164 | - continue; |
|
| 169 | + if ($entry->isDirectory()) { |
|
| 170 | + continue; |
|
| 171 | + } |
|
| 165 | 172 | $files[] = $entry->getPath(); |
| 166 | 173 | } |
| 167 | 174 | return $files; |
@@ -302,8 +309,9 @@ discard block |
||
| 302 | 309 | public function addFileFromString($inArchiveName, $content) |
| 303 | 310 | { |
| 304 | 311 | $tmp_file = tempnam(sys_get_temp_dir(), 'ua'); |
| 305 | - if (!$tmp_file) |
|
| 306 | - throw new ArchiveModificationException('Could not create temporarily file'); |
|
| 312 | + if (!$tmp_file) { |
|
| 313 | + throw new ArchiveModificationException('Could not create temporarily file'); |
|
| 314 | + } |
|
| 307 | 315 | |
| 308 | 316 | file_put_contents($tmp_file, $content); |
| 309 | 317 | $this->sevenZip->addEntry($tmp_file, true); |
@@ -353,8 +361,9 @@ discard block |
||
| 353 | 361 | $total_files = count($files); |
| 354 | 362 | |
| 355 | 363 | $seven_zip = new Archive7z($archiveFileName); |
| 356 | - if ($password !== null) |
|
| 357 | - $seven_zip->setPassword($password); |
|
| 364 | + if ($password !== null) { |
|
| 365 | + $seven_zip->setPassword($password); |
|
| 366 | + } |
|
| 358 | 367 | $seven_zip->setCompressionLevel($compressionLevelMap[$compressionLevel]); |
| 359 | 368 | foreach ($files as $localName => $filename) { |
| 360 | 369 | if ($filename !== null) { |
@@ -386,8 +395,9 @@ discard block |
||
| 386 | 395 | Formats::TAR, |
| 387 | 396 | Formats::LZMA, |
| 388 | 397 | Formats::ZIP] |
| 389 | - )) |
|
| 390 | - return self::canRenameFiles(); |
|
| 398 | + )) { |
|
| 399 | + return self::canRenameFiles(); |
|
| 400 | + } |
|
| 391 | 401 | |
| 392 | 402 | return false; |
| 393 | 403 | } |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | public static function getInstallationInstruction() |
| 91 | 91 | { |
| 92 | 92 | return !class_exists('\Archive_Tar') |
| 93 | - ? 'install library [pear/archive_tar]: `composer require pear/archive_tar`' . "\n" . ' and optionally php-extensions (zlib, bzip2)' |
|
| 93 | + ? 'install library [pear/archive_tar]: `composer require pear/archive_tar`'."\n".' and optionally php-extensions (zlib, bzip2)' |
|
| 94 | 94 | : null; |
| 95 | 95 | } |
| 96 | 96 | |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | $compression = 'lzma2'; |
| 137 | 137 | break; |
| 138 | 138 | case 'z': |
| 139 | - $tar_aname = 'compress.lzw://' . $archiveFileName; |
|
| 139 | + $tar_aname = 'compress.lzw://'.$archiveFileName; |
|
| 140 | 140 | break; |
| 141 | 141 | } |
| 142 | 142 | |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | |
| 194 | 194 | case Formats::TAR_LZW: |
| 195 | 195 | LzwStreamWrapper::registerWrapper(); |
| 196 | - $this->tar = new Archive_Tar('compress.lzw://' . $this->archiveFileName); |
|
| 196 | + $this->tar = new Archive_Tar('compress.lzw://'.$this->archiveFileName); |
|
| 197 | 197 | break; |
| 198 | 198 | |
| 199 | 199 | default: |
@@ -102,9 +102,9 @@ discard block |
||
| 102 | 102 | { |
| 103 | 103 | self::init(); |
| 104 | 104 | return static::$zippy === false |
| 105 | - ? 'install library [alchemy/zippy]: `composer require alchemy/zippy`' . "\n" . ' and console programs (tar, zip): `apt install tar zip` - depends on OS' |
|
| 106 | - . "\n" . 'If you install SevenZip and AlchemyZippy:' . "\n" . |
|
| 107 | -'1. You should specify symfony/console version before installation to any **3.x.x version**: `composer require symfony/process:~3.4`, because they require different `symfony/process` versions.' . "\n" . |
|
| 105 | + ? 'install library [alchemy/zippy]: `composer require alchemy/zippy`'."\n".' and console programs (tar, zip): `apt install tar zip` - depends on OS' |
|
| 106 | + . "\n".'If you install SevenZip and AlchemyZippy:'."\n". |
|
| 107 | +'1. You should specify symfony/console version before installation to any **3.x.x version**: `composer require symfony/process:~3.4`, because they require different `symfony/process` versions.'."\n". |
|
| 108 | 108 | '2. Install archive7z version 4.0.0: `composer require gemorroj/archive7z:~4.0`' |
| 109 | 109 | : null; |
| 110 | 110 | } |
@@ -207,8 +207,8 @@ discard block |
||
| 207 | 207 | |
| 208 | 208 | $this->files[] = $information->files[] = str_replace('\\', '/', $member->getLocation()); |
| 209 | 209 | $this->members[str_replace('\\', '/', $member->getLocation())] = $member; |
| 210 | - $information->compressedFilesSize += (int)$member->getSize(); |
|
| 211 | - $information->uncompressedFilesSize += (int)$member->getSize(); |
|
| 210 | + $information->compressedFilesSize += (int) $member->getSize(); |
|
| 211 | + $information->uncompressedFilesSize += (int) $member->getSize(); |
|
| 212 | 212 | } |
| 213 | 213 | return $information; |
| 214 | 214 | } |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | public function getFileContent($fileName) |
| 258 | 258 | { |
| 259 | 259 | $member = $this->getMember($fileName); |
| 260 | - return (string)$member; |
|
| 260 | + return (string) $member; |
|
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | /** |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | public function getFileStream($fileName) |
| 267 | 267 | { |
| 268 | 268 | $member = $this->getMember($fileName); |
| 269 | - return self::wrapStringInStream((string)$member); |
|
| 269 | + return self::wrapStringInStream((string) $member); |
|
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | /** |
@@ -52,7 +52,7 @@ |
||
| 52 | 52 | public static function getInstallationInstruction() |
| 53 | 53 | { |
| 54 | 54 | return !extension_loaded('rar') |
| 55 | - ? 'install [rar] extension.' . "\n" . 'Can be installed with pecl: `pecl install rar`' |
|
| 55 | + ? 'install [rar] extension.'."\n".'Can be installed with pecl: `pecl install rar`' |
|
| 56 | 56 | : null; |
| 57 | 57 | } |
| 58 | 58 | |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | */ |
| 13 | 13 | class Lzma extends OneFileDriver |
| 14 | 14 | { |
| 15 | - const FORMAT_SUFFIX = 'xz'; |
|
| 15 | + const FORMAT_SUFFIX = 'xz'; |
|
| 16 | 16 | |
| 17 | 17 | /** |
| 18 | 18 | * @return array |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | public static function getInstallationInstruction() |
| 51 | 51 | { |
| 52 | 52 | return !extension_loaded('xz') |
| 53 | - ? 'install [xz] extension' . "\n" . 'For 5.x: https://github.com/payden/php-xz' . "\n" . 'For 7.x: https://github.com/codemasher/php-ext-xz' |
|
| 53 | + ? 'install [xz] extension'."\n".'For 5.x: https://github.com/payden/php-xz'."\n".'For 7.x: https://github.com/codemasher/php-ext-xz' |
|
| 54 | 54 | : null; |
| 55 | 55 | } |
| 56 | 56 | |