Passed
Push — master ( 4db184...75f148 )
by f
23:35 queued 08:35
created
src/Commands/InfoCommand.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -26,15 +26,15 @@
 block discarded – undo
26 26
         $file = realpath($input->getArgument('archive'));
27 27
         $archive = $this->getArchive($input, $output);
28 28
 
29
-        $output->writeln('Filename: ' . $file . ' (changed <comment>' . $this->formatDate(filemtime($file)) . '</comment>)');
30
-        $output->writeln('Type: <info>' . $archive->getFormat() . '</info>, mime <info>' . $archive->getMimeType() . '</info> (via driver <comment>' . $archive->getDriverType() . '</comment>)');
31
-        $output->writeln('Contains: ' . $archive->countFiles() . ' file' . ($archive->countFiles() > 1 ? 's' : null));
29
+        $output->writeln('Filename: '.$file.' (changed <comment>'.$this->formatDate(filemtime($file)).'</comment>)');
30
+        $output->writeln('Type: <info>'.$archive->getFormat().'</info>, mime <info>'.$archive->getMimeType().'</info> (via driver <comment>'.$archive->getDriverType().'</comment>)');
31
+        $output->writeln('Contains: '.$archive->countFiles().' file'.($archive->countFiles() > 1 ? 's' : null));
32 32
         $output->writeln('Size:');
33
-        $output->writeln("\t". 'uncompressed: '.implode(' ', $this->formatSize($archive->getOriginalSize(), 2)));
34
-        $output->writeln("\t" . 'compressed: ' . implode(' ', $this->formatSize($archive->getCompressedSize(), 2)));
35
-        $output->writeln("\t" . 'ratio: <info>' . round($archive->getOriginalSize() / $archive->getCompressedSize(), 6) . '/1 (' . floor($archive->getCompressedSize() / $archive->getOriginalSize() * 100) . '%</info>)');
33
+        $output->writeln("\t".'uncompressed: '.implode(' ', $this->formatSize($archive->getOriginalSize(), 2)));
34
+        $output->writeln("\t".'compressed: '.implode(' ', $this->formatSize($archive->getCompressedSize(), 2)));
35
+        $output->writeln("\t".'ratio: <info>'.round($archive->getOriginalSize() / $archive->getCompressedSize(), 6).'/1 ('.floor($archive->getCompressedSize() / $archive->getOriginalSize() * 100).'%</info>)');
36 36
         if (!empty($comment = $archive->getComment()))
37
-            $output->writeln('Comment: <comment>' . $comment . '</comment>');
37
+            $output->writeln('Comment: <comment>'.$comment.'</comment>');
38 38
 
39 39
         return 0;
40 40
     }
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,8 +33,9 @@
 block discarded – undo
33 33
         $output->writeln("\t". 'uncompressed: '.implode(' ', $this->formatSize($archive->getOriginalSize(), 2)));
34 34
         $output->writeln("\t" . 'compressed: ' . implode(' ', $this->formatSize($archive->getCompressedSize(), 2)));
35 35
         $output->writeln("\t" . 'ratio: <info>' . round($archive->getOriginalSize() / $archive->getCompressedSize(), 6) . '/1 (' . floor($archive->getCompressedSize() / $archive->getOriginalSize() * 100) . '%</info>)');
36
-        if (!empty($comment = $archive->getComment()))
37
-            $output->writeln('Comment: <comment>' . $comment . '</comment>');
36
+        if (!empty($comment = $archive->getComment())) {
37
+                    $output->writeln('Comment: <comment>' . $comment . '</comment>');
38
+        }
38 39
 
39 40
         return 0;
40 41
     }
Please login to merge, or discard this patch.
src/Commands/ExtractFilesCommand.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
33 33
         $entry_selector = $input->getArgument('entrySelector');
34 34
 
35 35
         $archive->extractFiles($output_dir, $entry_selector, true);
36
-        $output->writeln('<info>Extracted:</info> ' . implode(', ', $entry_selector) . ' (' . count($entry_selector) . ') file(s)');
36
+        $output->writeln('<info>Extracted:</info> '.implode(', ', $entry_selector).' ('.count($entry_selector).') file(s)');
37 37
 
38 38
         return 0;
39 39
     }
Please login to merge, or discard this patch.
src/Commands/DeleteFileCommand.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
33 33
         list($archive, $file) = $this->getArchiveAndFile($input, $output);
34 34
 
35 35
         $archive->deleteFiles($file);
36
-        $output->writeln('<comment>- file "' . $file . '"</comment>');
36
+        $output->writeln('<comment>- file "'.$file.'"</comment>');
37 37
 
38 38
         return 0;
39 39
     }
Please login to merge, or discard this patch.
src/Commands/ExtractFileCommand.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,14 +27,14 @@
 block discarded – undo
27 27
         list($archive, $file) = $this->getArchiveAndFile($input, $output);
28 28
         $destination = $input->getArgument('destination');
29 29
         if (is_dir($destination)) {
30
-            $destination = $destination . '/' . basename($file);
30
+            $destination = $destination.'/'.basename($file);
31 31
         }
32 32
 
33 33
         $overwrite = $input->getOption('overwrite');
34 34
 
35 35
         if (file_exists($destination) && !$overwrite) {
36 36
             if ($input->getOption('no-interaction')) {
37
-                throw new \LogicException('File destination ' . $destination . ' exists');
37
+                throw new \LogicException('File destination '.$destination.' exists');
38 38
             }
39 39
         }
40 40
 
Please login to merge, or discard this patch.
src/ArchiveEntry.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -46,8 +46,9 @@
 block discarded – undo
46 46
         $this->compressedSize = $compressedSize;
47 47
         $this->uncompressedSize = $uncompressedSize;
48 48
         $this->modificationTime = $modificationTime;
49
-        if ($isCompressed === null)
50
-            $isCompressed = $uncompressedSize !== $compressedSize;
49
+        if ($isCompressed === null) {
50
+                    $isCompressed = $uncompressedSize !== $compressedSize;
51
+        }
51 52
         $this->isCompressed = $isCompressed;
52 53
         $this->comment = $comment;
53 54
         $this->crc32 = $crc32;
Please login to merge, or discard this patch.
src/Drivers/SevenZip.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
     public static function getInstallationInstruction()
109 109
     {
110 110
         if (!class_exists('\Archive7z\Archive7z'))
111
-            return 'install library [gemorroj/archive7z]: `composer require gemorroj/archive7z`' . "\n"
111
+            return 'install library [gemorroj/archive7z]: `composer require gemorroj/archive7z`'."\n"
112 112
                 . ' and console program p7zip [7za]: `apt install p7zip-full` - depends on OS';
113 113
 
114 114
         if (Archive7z::getBinaryVersion() === false)
@@ -150,8 +150,8 @@  discard block
 block discarded – undo
150 150
             $information->files[] = $can_get_unix_path
151 151
                 ? $entry->getUnixPath()
152 152
                 : str_replace('\\', '/', $entry->getPath());
153
-            $information->compressedFilesSize += (int)$entry->getPackedSize();
154
-            $information->uncompressedFilesSize += (int)$entry->getSize();
153
+            $information->compressedFilesSize += (int) $entry->getPackedSize();
154
+            $information->uncompressedFilesSize += (int) $entry->getSize();
155 155
         }
156 156
         return $information;
157 157
     }
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
     {
210 210
         $entry = $this->sevenZip->getEntry($fileName);
211 211
         if ($entry === null) {
212
-            throw new NonExistentArchiveFileException('File ' . $fileName . ' does not exist');
212
+            throw new NonExistentArchiveFileException('File '.$fileName.' does not exist');
213 213
         }
214 214
         return $entry->getContent();
215 215
     }
Please login to merge, or discard this patch.
Braces   +21 added lines, -14 removed lines patch added patch discarded remove patch
@@ -120,12 +120,14 @@  discard block
 block discarded – undo
120 120
      */
121 121
     public static function getInstallationInstruction()
122 122
     {
123
-        if (!class_exists('\Archive7z\Archive7z'))
124
-            return 'install library [gemorroj/archive7z]: `composer require gemorroj/archive7z`' . "\n"
123
+        if (!class_exists('\Archive7z\Archive7z')) {
124
+                    return 'install library [gemorroj/archive7z]: `composer require gemorroj/archive7z`' . "\n"
125 125
                 . ' and console program p7zip [7za]: `apt install p7zip-full` - depends on OS';
126
+        }
126 127
 
127
-        if (Archive7z::getBinaryVersion() === false)
128
-            return 'install console program p7zip [7za]: `apt install p7zip-full` - depends on OS';
128
+        if (Archive7z::getBinaryVersion() === false) {
129
+                    return 'install console program p7zip [7za]: `apt install p7zip-full` - depends on OS';
130
+        }
129 131
 
130 132
         return null;
131 133
     }
@@ -138,8 +140,9 @@  discard block
 block discarded – undo
138 140
         try {
139 141
             $this->format = $format;
140 142
             $this->sevenZip = new Archive7z($archiveFileName, null, null);
141
-            if ($password !== null)
142
-                $this->sevenZip->setPassword($password);
143
+            if ($password !== null) {
144
+                            $this->sevenZip->setPassword($password);
145
+            }
143 146
         } catch (\Archive7z\Exception $e) {
144 147
             throw new Exception('Could not open 7Zip archive: '.$e->getMessage(), $e->getCode(), $e);
145 148
         }
@@ -157,8 +160,9 @@  discard block
 block discarded – undo
157 160
                 continue;
158 161
             }
159 162
 
160
-            if (!isset($can_get_unix_path))
161
-                $can_get_unix_path = method_exists($entry, 'getUnixPath');
163
+            if (!isset($can_get_unix_path)) {
164
+                            $can_get_unix_path = method_exists($entry, 'getUnixPath');
165
+            }
162 166
 
163 167
             $information->files[] = $can_get_unix_path
164 168
                 ? $entry->getUnixPath()
@@ -176,8 +180,9 @@  discard block
 block discarded – undo
176 180
     {
177 181
         $files = [];
178 182
         foreach ($this->sevenZip->getEntries() as $entry) {
179
-            if ($entry->isDirectory())
180
-                continue;
183
+            if ($entry->isDirectory()) {
184
+                            continue;
185
+            }
181 186
             $files[] = $entry->getPath();
182 187
         }
183 188
         return $files;
@@ -329,8 +334,9 @@  discard block
 block discarded – undo
329 334
     public function addFileFromString($inArchiveName, $content)
330 335
     {
331 336
         $tmp_file = tempnam(sys_get_temp_dir(), 'ua');
332
-        if (!$tmp_file)
333
-            throw new ArchiveModificationException('Could not create temporarily file');
337
+        if (!$tmp_file) {
338
+                    throw new ArchiveModificationException('Could not create temporarily file');
339
+        }
334 340
 
335 341
         file_put_contents($tmp_file, $content);
336 342
         $this->sevenZip->addEntry($tmp_file, true);
@@ -380,8 +386,9 @@  discard block
 block discarded – undo
380 386
             $total_files = count($files);
381 387
 
382 388
             $seven_zip = new Archive7z($archiveFileName);
383
-            if ($password !== null)
384
-                $seven_zip->setPassword($password);
389
+            if ($password !== null) {
390
+                            $seven_zip->setPassword($password);
391
+            }
385 392
             $seven_zip->setCompressionLevel($compressionLevelMap[$compressionLevel]);
386 393
             foreach ($files as $localName => $filename) {
387 394
                 if ($filename !== null) {
Please login to merge, or discard this patch.
src/Commands/TestCommand.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,8 +28,8 @@
 block discarded – undo
28 28
             $output->writeln('<info>Archive is ok!</info>');
29 29
         } else {
30 30
             $output->writeln('<error>Failed:</error>:');
31
-            array_walk($test_result, static function ($file) use ($output) {
32
-                $output->writeln('- ' . $file);
31
+            array_walk($test_result, static function($file) use ($output) {
32
+                $output->writeln('- '.$file);
33 33
             });
34 34
         }
35 35
         return 0;
Please login to merge, or discard this patch.
src/Commands/FormatCommand.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
             $question = new ChoiceQuestion('Which format', array_keys($formats));
42 42
             $format = $helper->ask($input, $output, $question);
43 43
         }
44
-        $output->writeln('Format <info>' . $format . '</info> drivers support');
44
+        $output->writeln('Format <info>'.$format.'</info> drivers support');
45 45
 
46 46
         $table = new Table($output);
47 47
         $table->setHeaders(['format', ...array_keys(self::$abilitiesLabels)]);
Please login to merge, or discard this patch.
src/Drivers/TarByPear.php 2 patches
Braces   +26 added lines, -18 removed lines patch added patch discarded remove patch
@@ -165,10 +165,11 @@  discard block
 block discarded – undo
165 165
                 break;
166 166
         }
167 167
 
168
-        if (isset($tar_aname))
169
-            $tar = new Archive_Tar($tar_aname, $compression);
170
-        else
171
-            $tar = new Archive_Tar($archiveFileName, $compression);
168
+        if (isset($tar_aname)) {
169
+                    $tar = new Archive_Tar($tar_aname, $compression);
170
+        } else {
171
+                    $tar = new Archive_Tar($archiveFileName, $compression);
172
+        }
172 173
 
173 174
         $current_file = 0;
174 175
         $total_files = count($files);
@@ -177,11 +178,13 @@  discard block
 block discarded – undo
177 178
             $add_dir = dirname($localName);
178 179
 
179 180
             if (is_null($filename)) {
180
-                if ($tar->addString($localName, '') === false)
181
-                    throw new ArchiveCreationException('Error when adding directory '.$localName.' to archive');
181
+                if ($tar->addString($localName, '') === false) {
182
+                                    throw new ArchiveCreationException('Error when adding directory '.$localName.' to archive');
183
+                }
182 184
             } else {
183
-                if ($tar->addModify($filename, $add_dir, $remove_dir) === false)
184
-                    throw new ArchiveCreationException('Error when adding file '.$filename.' to archive');
185
+                if ($tar->addModify($filename, $add_dir, $remove_dir) === false) {
186
+                                    throw new ArchiveCreationException('Error when adding file '.$filename.' to archive');
187
+                }
185 188
             }
186 189
             if ($fileProgressCallable !== null) {
187 190
                 call_user_func_array($fileProgressCallable, [$current_file++, $total_files, $filename, $localName]);
@@ -242,8 +245,9 @@  discard block
 block discarded – undo
242 245
                 continue;
243 246
             }
244 247
             // skip directories
245
-            if ($file['typeflag'] == '5' || substr($file['filename'], -1) === '/')
246
-                continue;
248
+            if ($file['typeflag'] == '5' || substr($file['filename'], -1) === '/') {
249
+                            continue;
250
+            }
247 251
             $information->files[] = $file['filename'];
248 252
             $information->uncompressedFilesSize += $file['size'];
249 253
             $this->pearFilesIndex[$file['filename']] = $i;
@@ -289,14 +293,16 @@  discard block
 block discarded – undo
289 293
      */
290 294
     public function getFileData($fileName)
291 295
     {
292
-        if (!isset($this->pearFilesIndex[$fileName]))
293
-            throw new NonExistentArchiveFileException('File '.$fileName.' is not found in archive files list');
296
+        if (!isset($this->pearFilesIndex[$fileName])) {
297
+                    throw new NonExistentArchiveFileException('File '.$fileName.' is not found in archive files list');
298
+        }
294 299
 
295 300
         $index = $this->pearFilesIndex[$fileName];
296 301
 
297 302
         $files_list = $this->tar->listContent();
298
-        if (!isset($files_list[$index]))
299
-            throw new NonExistentArchiveFileException('File '.$fileName.' is not found in Tar archive');
303
+        if (!isset($files_list[$index])) {
304
+                    throw new NonExistentArchiveFileException('File '.$fileName.' is not found in Tar archive');
305
+        }
300 306
 
301 307
         $data = $files_list[$index];
302 308
         unset($files_list);
@@ -311,8 +317,9 @@  discard block
 block discarded – undo
311 317
      */
312 318
     public function getFileContent($fileName)
313 319
     {
314
-        if (!isset($this->pearFilesIndex[$fileName]))
315
-            throw new NonExistentArchiveFileException('File '.$fileName.' is not found in archive files list');
320
+        if (!isset($this->pearFilesIndex[$fileName])) {
321
+                    throw new NonExistentArchiveFileException('File '.$fileName.' is not found in archive files list');
322
+        }
316 323
 
317 324
         return $this->tar->extractInString($fileName);
318 325
     }
@@ -322,8 +329,9 @@  discard block
 block discarded – undo
322 329
      */
323 330
     public function getFileStream($fileName)
324 331
     {
325
-        if (!isset($this->pearFilesIndex[$fileName]))
326
-            throw new NonExistentArchiveFileException('File '.$fileName.' is not found in archive files list');
332
+        if (!isset($this->pearFilesIndex[$fileName])) {
333
+                    throw new NonExistentArchiveFileException('File '.$fileName.' is not found in archive files list');
334
+        }
327 335
 
328 336
         return self::wrapStringInStream($this->tar->extractInString($fileName));
329 337
     }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
      */
59 59
     public static function getInstallationInstruction()
60 60
     {
61
-        return 'install library [pear/archive_tar]: `composer require pear/archive_tar`' . "\n"  . ' and optionally php-extensions (zlib, bz2)';
61
+        return 'install library [pear/archive_tar]: `composer require pear/archive_tar`'."\n".' and optionally php-extensions (zlib, bz2)';
62 62
     }
63 63
 
64 64
     /**
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
                 $compression = 'lzma2';
166 166
                 break;
167 167
             case 'z':
168
-                $tar_aname = 'compress.lzw://' . $archiveFileName;
168
+                $tar_aname = 'compress.lzw://'.$archiveFileName;
169 169
                 break;
170 170
         }
171 171
 
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 
223 223
             case Formats::TAR_LZW:
224 224
                 LzwStreamWrapper::registerWrapper();
225
-                $this->tar = new Archive_Tar('compress.lzw://' . $this->archiveFileName);
225
+                $this->tar = new Archive_Tar('compress.lzw://'.$this->archiveFileName);
226 226
                 break;
227 227
 
228 228
             default:
Please login to merge, or discard this patch.