Passed
Push — master ( 0d8a9b...48a836 )
by f
12:20
created
src/Commands/TestCommand.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@
 block discarded – undo
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 {
Please login to merge, or discard this patch.
src/Commands/InfoCommand.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -27,15 +27,15 @@
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,8 +34,9 @@
 block discarded – undo
34 34
         $output->writeln("\t". 'uncompressed: '.implode(' ', $this->formatSize($archive->getOriginalSize(), 2)));
35 35
         $output->writeln("\t" . 'compressed: ' . implode(' ', $this->formatSize($archive->getCompressedSize(), 2)));
36 36
         $output->writeln("\t" . 'ratio: <info>' . round($archive->getOriginalSize() / $archive->getCompressedSize(), 6) . '/1 (' . floor($archive->getCompressedSize() / $archive->getOriginalSize() * 100) . '%</info>)');
37
-        if ($archive->getDriver()->checkAbility(BasicDriver::GET_COMMENT) && !empty($comment = $archive->getComment()))
38
-            $output->writeln('Comment: <comment>' . $comment . '</comment>');
37
+        if ($archive->getDriver()->checkAbility(BasicDriver::GET_COMMENT) && !empty($comment = $archive->getComment())) {
38
+                    $output->writeln('Comment: <comment>' . $comment . '</comment>');
39
+        }
39 40
 
40 41
         return 0;
41 42
     }
Please login to merge, or discard this patch.
src/Commands/BaseCommand.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -114,10 +114,10 @@
 block discarded – undo
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] !== '\\') {
Please login to merge, or discard this patch.
Braces   +16 added lines, -13 removed lines patch added patch discarded remove patch
@@ -43,12 +43,14 @@  discard block
 block discarded – undo
43 43
      */
44 44
     protected function open($file, $password = null)
45 45
     {
46
-        if (!UnifiedArchive::canOpen($file))
47
-            throw new \Exception('Could not open archive '.$file.'. Try installing suggested packages or run `cam -f` to see formats support.');
46
+        if (!UnifiedArchive::canOpen($file)) {
47
+                    throw new \Exception('Could not open archive '.$file.'. Try installing suggested packages or run `cam -f` to see formats support.');
48
+        }
48 49
 
49 50
         $archive = UnifiedArchive::open($file, [], $password);
50
-        if ($archive === null)
51
-            throw new \Exception('Could not open archive '.$file);
51
+        if ($archive === null) {
52
+                    throw new \Exception('Could not open archive '.$file);
53
+        }
52 54
 
53 55
         return $archive;
54 56
     }
@@ -61,17 +63,18 @@  discard block
 block discarded – undo
61 63
      */
62 64
     public function formatDate($unixtime)
63 65
     {
64
-        if (strtotime('today') < $unixtime)
65
-            return 'Today, '.date('G:m', $unixtime);
66
-        else if (strtotime('yesterday') < $unixtime)
67
-            return 'Yesterday, '.date('G:m', $unixtime);
68
-        else {
66
+        if (strtotime('today') < $unixtime) {
67
+                    return 'Today, '.date('G:m', $unixtime);
68
+        } else if (strtotime('yesterday') < $unixtime) {
69
+                    return 'Yesterday, '.date('G:m', $unixtime);
70
+        } else {
69 71
             $datetime = new \DateTime();
70 72
             $datetime->setTimestamp($unixtime);
71
-            if ($datetime->format('Y') == date('Y'))
72
-                return $datetime->format('d M, H:m');
73
-            else
74
-                return $datetime->format('d M Y, H:m');
73
+            if ($datetime->format('Y') == date('Y')) {
74
+                            return $datetime->format('d M, H:m');
75
+            } else {
76
+                            return $datetime->format('d M Y, H:m');
77
+            }
75 78
         }
76 79
     }
77 80
 
Please login to merge, or discard this patch.
src/Commands/FormatsCommand.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -33,9 +33,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
src/Commands/DriversCommand.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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)
Please login to merge, or discard this patch.
src/Drivers/Iso.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -136,11 +136,11 @@  discard block
 block discarded – undo
136 136
                     $this->files[$file->Location] = $directory.$file->strd_FileId;
137 137
                     $this->filesSize += $file->DataLen;
138 138
 
139
-                    $this->filesData[$directory . $file->strd_FileId] =
139
+                    $this->filesData[$directory.$file->strd_FileId] =
140 140
                         [
141 141
                             'size' => $file->DataLen,
142 142
                             'mtime' =>
143
-                                strtotime((string)$file->isoRecDate),
143
+                                strtotime((string) $file->isoRecDate),
144 144
                         ];
145 145
                 }
146 146
             }
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
     public function extractFiles($outputFolder, array $files)
243 243
     {
244 244
         foreach ($files as $file) {
245
-            $destination_file = rtrim($outputFolder, '/'). '/' . ltrim($file, '/');
245
+            $destination_file = rtrim($outputFolder, '/').'/'.ltrim($file, '/');
246 246
             $destination_dir = dirname($destination_file);
247 247
 
248 248
             if (!empty($destination_dir)) {
Please login to merge, or discard this patch.
Braces   +18 added lines, -11 removed lines patch added patch discarded remove patch
@@ -84,8 +84,9 @@  discard block
 block discarded – undo
84 84
     {
85 85
         parent::__construct($archiveFileName, $format);
86 86
         $this->open($archiveFileName);
87
-        if ($password !== null)
88
-            throw new UnsupportedOperationException('Iso archive does not support password!');
87
+        if ($password !== null) {
88
+                    throw new UnsupportedOperationException('Iso archive does not support password!');
89
+        }
89 90
     }
90 91
 
91 92
     /**
@@ -108,8 +109,9 @@  discard block
 block discarded – undo
108 109
 
109 110
         /** @var \CVolumeDescriptor $usedDesc */
110 111
         $usedDesc = $this->iso->GetDescriptor(SUPPLEMENTARY_VOLUME_DESC);
111
-        if (!$usedDesc)
112
-            $usedDesc = $this->iso->GetDescriptor(PRIMARY_VOLUME_DESC);
112
+        if (!$usedDesc) {
113
+                    $usedDesc = $this->iso->GetDescriptor(PRIMARY_VOLUME_DESC);
114
+        }
113 115
         $this->blockSize = $usedDesc->iBlockSize;
114 116
         $directories = $usedDesc->LoadMPathTable($this->iso);
115 117
         // iterate over all directories
@@ -131,8 +133,9 @@  discard block
 block discarded – undo
131 133
             if ($files) {
132 134
                 /** @var \CFileDirDescriptors $file */
133 135
                 foreach ($files as $file) {
134
-                    if (in_array($file->strd_FileId, ['.', '..']) || $file->IsDirectory())
135
-                        continue;
136
+                    if (in_array($file->strd_FileId, ['.', '..']) || $file->IsDirectory()) {
137
+                                            continue;
138
+                    }
136 139
                     $this->files[$file->Location] = $directory.$file->strd_FileId;
137 140
                     $this->filesSize += $file->DataLen;
138 141
 
@@ -184,8 +187,9 @@  discard block
 block discarded – undo
184 187
      */
185 188
     public function getFileData($fileName)
186 189
     {
187
-        if (!isset($this->filesData[$fileName]))
188
-            return false;
190
+        if (!isset($this->filesData[$fileName])) {
191
+                    return false;
192
+        }
189 193
 
190 194
         return new ArchiveEntry(
191 195
             $fileName,
@@ -225,11 +229,14 @@  discard block
 block discarded – undo
225 229
     protected function prepareForFileExtracting($fileName)
226 230
     {
227 231
         $Location = array_search($fileName, $this->files, true);
228
-        if (!isset($this->filesData[$fileName])) return false;
232
+        if (!isset($this->filesData[$fileName])) {
233
+         return false;
234
+        }
229 235
         $data = $this->filesData[$fileName];
230 236
         $Location_Real = $Location * $this->blockSize;
231
-        if ($this->iso->Seek($Location_Real, SEEK_SET) === false)
232
-            return false;
237
+        if ($this->iso->Seek($Location_Real, SEEK_SET) === false) {
238
+                    return false;
239
+        }
233 240
         return $data;
234 241
     }
235 242
 
Please login to merge, or discard this patch.
src/Drivers/NelexaZip.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -87,8 +87,9 @@
 block discarded – undo
87 87
             : $this->zip->getEntries();
88 88
 
89 89
         foreach ($files as $info) {
90
-            if (method_exists($info, 'isFolder') ? $info->isFolder() : $info->isDirectory())
91
-                continue;
90
+            if (method_exists($info, 'isFolder') ? $info->isFolder() : $info->isDirectory()) {
91
+                            continue;
92
+            }
92 93
 
93 94
             $this->files[] = $information->files[] = str_replace('\\', '/', $info->getName());
94 95
             $information->compressedFilesSize += $info->getCompressedSize();
Please login to merge, or discard this patch.
src/Commands/ExtractArchiveCommand.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,11 +31,11 @@
 block discarded – undo
31 31
         $archive = $this->getArchive($input, $output);
32 32
 
33 33
         if (disk_free_space($output_dir) < $archive->getOriginalSize()) {
34
-            throw new \LogicException('Archive size ' . implode($this->formatSize($archive->getOriginalSize())) . ' is more that available on disk '
34
+            throw new \LogicException('Archive size '.implode($this->formatSize($archive->getOriginalSize())).' is more that available on disk '
35 35
                                       . implode($this->formatSize(disk_free_space($output_dir))));
36 36
         }
37 37
         $archive->extract($output_dir, $entry_selector, true);
38
-        $output->writeln('<info>Extracted all archive contents (' . implode($this->formatSize($archive->getOriginalSize())) . ')</info>');
38
+        $output->writeln('<info>Extracted all archive contents ('.implode($this->formatSize($archive->getOriginalSize())).')</info>');
39 39
 
40 40
         return 0;
41 41
     }
Please login to merge, or discard this patch.
src/Commands/ListCommand.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -60,17 +60,17 @@
 block discarded – undo
60 60
             foreach ($archive->getFiles($filter) as $file) {
61 61
                 $details = $archive->getFileData($file);
62 62
                 $output->writeln(($details->isCompressed && $details->uncompressedSize > 0 ? 'x' : '-')
63
-                                 . ' ' . str_pad(
63
+                                 . ' '.str_pad(
64 64
                                      $human_readable_size ? implode($this->formatSize($details->uncompressedSize)) : $details->uncompressedSize,
65 65
                                      $uncomp_size_length,
66 66
                                      ' ',
67 67
                                      STR_PAD_LEFT)
68
-                                 . ' ' . str_pad(
68
+                                 . ' '.str_pad(
69 69
                                      $human_readable_size ? implode($this->formatSize($details->compressedSize)) : $details->compressedSize,
70 70
                                      $comp_size_length,
71 71
                                      ' ',
72 72
                                      STR_PAD_LEFT)
73
-                                 . ' ' . $this->formatDateShort($details->modificationTime) . ' ' . $details->path);
73
+                                 . ' '.$this->formatDateShort($details->modificationTime).' '.$details->path);
74 74
             }
75 75
         } else {
76 76
             foreach ($archive->getFiles($filter) as $file) {
Please login to merge, or discard this patch.