@@ -36,12 +36,14 @@ discard block |
||
36 | 36 | */ |
37 | 37 | public static function getInstallationInstruction() |
38 | 38 | { |
39 | - if (!class_exists('\Archive7z\Archive7z')) |
|
40 | - return 'install library [gemorroj/archive7z]: `composer require gemorroj/archive7z`' . "\n" |
|
39 | + if (!class_exists('\Archive7z\Archive7z')) { |
|
40 | + return 'install library [gemorroj/archive7z]: `composer require gemorroj/archive7z`' . "\n" |
|
41 | 41 | . ' and console program p7zip [7za]: `apt install p7zip-full` - depends on OS'; |
42 | + } |
|
42 | 43 | |
43 | - if (Archive7z::getBinaryVersion() === false) |
|
44 | - return 'install console program p7zip [7za]: `apt install p7zip-full` - depends on OS'; |
|
44 | + if (Archive7z::getBinaryVersion() === false) { |
|
45 | + return 'install console program p7zip [7za]: `apt install p7zip-full` - depends on OS'; |
|
46 | + } |
|
45 | 47 | |
46 | 48 | return null; |
47 | 49 | } |
@@ -145,8 +147,9 @@ discard block |
||
145 | 147 | try { |
146 | 148 | $this->format = $format; |
147 | 149 | $this->sevenZip = new Archive7z($archiveFileName, null, null); |
148 | - if ($password !== null) |
|
149 | - $this->sevenZip->setPassword($password); |
|
150 | + if ($password !== null) { |
|
151 | + $this->sevenZip->setPassword($password); |
|
152 | + } |
|
150 | 153 | } catch (\Archive7z\Exception $e) { |
151 | 154 | throw new Exception('Could not open 7Zip archive: '.$e->getMessage(), $e->getCode(), $e); |
152 | 155 | } |
@@ -164,8 +167,9 @@ discard block |
||
164 | 167 | continue; |
165 | 168 | } |
166 | 169 | |
167 | - if (!isset($can_get_unix_path)) |
|
168 | - $can_get_unix_path = method_exists($entry, 'getUnixPath'); |
|
170 | + if (!isset($can_get_unix_path)) { |
|
171 | + $can_get_unix_path = method_exists($entry, 'getUnixPath'); |
|
172 | + } |
|
169 | 173 | |
170 | 174 | $information->files[] = $can_get_unix_path |
171 | 175 | ? $entry->getUnixPath() |
@@ -183,8 +187,9 @@ discard block |
||
183 | 187 | { |
184 | 188 | $files = []; |
185 | 189 | foreach ($this->sevenZip->getEntries() as $entry) { |
186 | - if ($entry->isDirectory()) |
|
187 | - continue; |
|
190 | + if ($entry->isDirectory()) { |
|
191 | + continue; |
|
192 | + } |
|
188 | 193 | $files[] = $entry->getPath(); |
189 | 194 | } |
190 | 195 | return $files; |
@@ -336,8 +341,9 @@ discard block |
||
336 | 341 | public function addFileFromString($inArchiveName, $content) |
337 | 342 | { |
338 | 343 | $tmp_file = tempnam(sys_get_temp_dir(), 'ua'); |
339 | - if (!$tmp_file) |
|
340 | - throw new ArchiveModificationException('Could not create temporarily file'); |
|
344 | + if (!$tmp_file) { |
|
345 | + throw new ArchiveModificationException('Could not create temporarily file'); |
|
346 | + } |
|
341 | 347 | |
342 | 348 | file_put_contents($tmp_file, $content); |
343 | 349 | $this->sevenZip->addEntry($tmp_file, true); |
@@ -387,8 +393,9 @@ discard block |
||
387 | 393 | $total_files = count($files); |
388 | 394 | |
389 | 395 | $seven_zip = new Archive7z($archiveFileName); |
390 | - if ($password !== null) |
|
391 | - $seven_zip->setPassword($password); |
|
396 | + if ($password !== null) { |
|
397 | + $seven_zip->setPassword($password); |
|
398 | + } |
|
392 | 399 | $seven_zip->setCompressionLevel($compressionLevelMap[$compressionLevel]); |
393 | 400 | foreach ($files as $archiveName => $localName) { |
394 | 401 | if ($localName !== null) { |
@@ -122,8 +122,9 @@ |
||
122 | 122 | public function extractArchive($outputFolder) |
123 | 123 | { |
124 | 124 | $data = $this->getFileContent($this->inArchiveFileName); |
125 | - if ($data === false) |
|
126 | - throw new ArchiveExtractionException('Could not extract archive'); |
|
125 | + if ($data === false) { |
|
126 | + throw new ArchiveExtractionException('Could not extract archive'); |
|
127 | + } |
|
127 | 128 | |
128 | 129 | $size = strlen($data); |
129 | 130 | $written = file_put_contents($outputFolder.$this->inArchiveFileName, $data); |