@@ -57,12 +57,14 @@ discard block |
||
| 57 | 57 | public static function checkFormatSupport($format) |
| 58 | 58 | { |
| 59 | 59 | $available = class_exists('\Archive7z\Archive7z') && Archive7z::getBinaryVersion() !== false; |
| 60 | - if (!$available) |
|
| 61 | - return false; |
|
| 60 | + if (!$available) { |
|
| 61 | + return false; |
|
| 62 | + } |
|
| 62 | 63 | |
| 63 | 64 | // in 4.0.0 version it was supporting only 7z |
| 64 | - if (!Archive7z::supportsAllFormats()) |
|
| 65 | - return $format === Formats::SEVEN_ZIP; |
|
| 65 | + if (!Archive7z::supportsAllFormats()) { |
|
| 66 | + return $format === Formats::SEVEN_ZIP; |
|
| 67 | + } |
|
| 66 | 68 | |
| 67 | 69 | switch ($format) { |
| 68 | 70 | case Formats::SEVEN_ZIP: |
@@ -103,11 +105,13 @@ discard block |
||
| 103 | 105 | */ |
| 104 | 106 | public static function getInstallationInstruction() |
| 105 | 107 | { |
| 106 | - if (!class_exists('\Archive7z\Archive7z')) |
|
| 107 | - return 'install library `gemorroj/archive7z` and console program p7zip (7za)'; |
|
| 108 | + if (!class_exists('\Archive7z\Archive7z')) { |
|
| 109 | + return 'install library `gemorroj/archive7z` and console program p7zip (7za)'; |
|
| 110 | + } |
|
| 108 | 111 | |
| 109 | - if (Archive7z::getBinaryVersion() === false) |
|
| 110 | - return 'install console program p7zip (7za)'; |
|
| 112 | + if (Archive7z::getBinaryVersion() === false) { |
|
| 113 | + return 'install console program p7zip (7za)'; |
|
| 114 | + } |
|
| 111 | 115 | |
| 112 | 116 | return null; |
| 113 | 117 | } |
@@ -120,8 +124,9 @@ discard block |
||
| 120 | 124 | try { |
| 121 | 125 | $this->format = $format; |
| 122 | 126 | $this->sevenZip = new Archive7z($archiveFileName, null, null); |
| 123 | - if ($password !== null) |
|
| 124 | - $this->sevenZip->setPassword($password); |
|
| 127 | + if ($password !== null) { |
|
| 128 | + $this->sevenZip->setPassword($password); |
|
| 129 | + } |
|
| 125 | 130 | } catch (\Archive7z\Exception $e) { |
| 126 | 131 | throw new Exception('Could not open 7Zip archive: '.$e->getMessage(), $e->getCode(), $e); |
| 127 | 132 | } |
@@ -139,8 +144,9 @@ discard block |
||
| 139 | 144 | continue; |
| 140 | 145 | } |
| 141 | 146 | |
| 142 | - if (!isset($can_get_unix_path)) |
|
| 143 | - $can_get_unix_path = method_exists($entry, 'getUnixPath'); |
|
| 147 | + if (!isset($can_get_unix_path)) { |
|
| 148 | + $can_get_unix_path = method_exists($entry, 'getUnixPath'); |
|
| 149 | + } |
|
| 144 | 150 | |
| 145 | 151 | $information->files[] = $can_get_unix_path |
| 146 | 152 | ? $entry->getUnixPath() |
@@ -158,8 +164,9 @@ discard block |
||
| 158 | 164 | { |
| 159 | 165 | $files = []; |
| 160 | 166 | foreach ($this->sevenZip->getEntries() as $entry) { |
| 161 | - if ($entry->isDirectory()) |
|
| 162 | - continue; |
|
| 167 | + if ($entry->isDirectory()) { |
|
| 168 | + continue; |
|
| 169 | + } |
|
| 163 | 170 | $files[] = $entry->getPath(); |
| 164 | 171 | } |
| 165 | 172 | return $files; |
@@ -300,8 +307,9 @@ discard block |
||
| 300 | 307 | public function addFileFromString($inArchiveName, $content) |
| 301 | 308 | { |
| 302 | 309 | $tmp_file = tempnam(sys_get_temp_dir(), 'ua'); |
| 303 | - if (!$tmp_file) |
|
| 304 | - throw new ArchiveModificationException('Could not create temporarily file'); |
|
| 310 | + if (!$tmp_file) { |
|
| 311 | + throw new ArchiveModificationException('Could not create temporarily file'); |
|
| 312 | + } |
|
| 305 | 313 | |
| 306 | 314 | file_put_contents($tmp_file, $content); |
| 307 | 315 | unset($content); |
@@ -331,8 +339,9 @@ discard block |
||
| 331 | 339 | |
| 332 | 340 | try { |
| 333 | 341 | $seven_zip = new Archive7z($archiveFileName); |
| 334 | - if ($password !== null) |
|
| 335 | - $seven_zip->setPassword($password); |
|
| 342 | + if ($password !== null) { |
|
| 343 | + $seven_zip->setPassword($password); |
|
| 344 | + } |
|
| 336 | 345 | $seven_zip->setCompressionLevel($compressionLevelMap[$compressionLevel]); |
| 337 | 346 | foreach ($files as $localName => $filename) { |
| 338 | 347 | if ($filename !== null) { |
@@ -361,8 +370,9 @@ discard block |
||
| 361 | 370 | Formats::TAR, |
| 362 | 371 | Formats::LZMA, |
| 363 | 372 | Formats::ZIP] |
| 364 | - )) |
|
| 365 | - return self::canRenameFiles(); |
|
| 373 | + )) { |
|
| 374 | + return self::canRenameFiles(); |
|
| 375 | + } |
|
| 366 | 376 | |
| 367 | 377 | return false; |
| 368 | 378 | } |