Passed
Push — master ( dcfe7d...ba3494 )
by f
13:35
created
src/Commands/ExtractFilesCommand.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,6 +33,6 @@
 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
 }
Please login to merge, or discard this patch.
src/Commands/DetailsCommand.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -31,18 +31,18 @@
 block discarded – undo
31 31
         $detect_mimetype = $input->getOption('detect-mimetype');
32 32
 
33 33
         $details = $archive->getFileData($file);
34
-        $output->writeln('File <info>' . $file . '</info>');
34
+        $output->writeln('File <info>'.$file.'</info>');
35 35
         if ($detect_mimetype) {
36
-            $output->writeln('Mime type: <info>' . $this->getMimeTypeByStream($archive->getFileStream($file)).'</info>');
36
+            $output->writeln('Mime type: <info>'.$this->getMimeTypeByStream($archive->getFileStream($file)).'</info>');
37 37
         }
38 38
 
39 39
         $output->writeln('Size:');
40
-        $output->writeln("\t". 'uncompressed: '.implode(' ', $this->formatSize($details->uncompressedSize, 2)));
41
-        $output->writeln("\t" . 'compressed: ' . implode(' ', $this->formatSize($details->compressedSize, 2)));
42
-        $output->writeln("\t" . 'ratio: <info>' . round($details->uncompressedSize / $details->compressedSize, 6) . '/1 (' . floor($details->compressedSize / $details->uncompressedSize * 100) . '%</info>)');
43
-        $output->writeln('Modificated: ' . $this->formatDate($details->modificationTime));
40
+        $output->writeln("\t".'uncompressed: '.implode(' ', $this->formatSize($details->uncompressedSize, 2)));
41
+        $output->writeln("\t".'compressed: '.implode(' ', $this->formatSize($details->compressedSize, 2)));
42
+        $output->writeln("\t".'ratio: <info>'.round($details->uncompressedSize / $details->compressedSize, 6).'/1 ('.floor($details->compressedSize / $details->uncompressedSize * 100).'%</info>)');
43
+        $output->writeln('Modificated: '.$this->formatDate($details->modificationTime));
44 44
         if (!empty($comment = $details->comment))
45
-            $output->writeln('Comment: <comment>' . $comment . '</comment>');
45
+            $output->writeln('Comment: <comment>'.$comment.'</comment>');
46 46
 
47 47
         if (empty($input->getArgument('file'))) {
48 48
             $helper = $this->getHelper('question');
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -41,8 +41,9 @@
 block discarded – undo
41 41
         $output->writeln("\t" . 'compressed: ' . implode(' ', $this->formatSize($details->compressedSize, 2)));
42 42
         $output->writeln("\t" . 'ratio: <info>' . round($details->uncompressedSize / $details->compressedSize, 6) . '/1 (' . floor($details->compressedSize / $details->uncompressedSize * 100) . '%</info>)');
43 43
         $output->writeln('Modificated: ' . $this->formatDate($details->modificationTime));
44
-        if (!empty($comment = $details->comment))
45
-            $output->writeln('Comment: <comment>' . $comment . '</comment>');
44
+        if (!empty($comment = $details->comment)) {
45
+                    $output->writeln('Comment: <comment>' . $comment . '</comment>');
46
+        }
46 47
 
47 48
         if (empty($input->getArgument('file'))) {
48 49
             $helper = $this->getHelper('question');
Please login to merge, or discard this patch.
src/Commands/TableCommand.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@
 block discarded – undo
88 88
         }
89 89
 
90 90
         if ($sort !== null) {
91
-            usort($rows, function (array $a, array $b) use ($sort_field) {
91
+            usort($rows, function(array $a, array $b) use ($sort_field) {
92 92
                 if ($a[$sort_field] > $b[$sort_field]) {
93 93
                     return 1;
94 94
                 }
Please login to merge, or discard this patch.
src/Commands/BaseCommand.php 1 patch
Braces   +16 added lines, -13 removed lines patch added patch discarded remove patch
@@ -15,12 +15,14 @@  discard block
 block discarded – undo
15 15
      */
16 16
     protected function open($file, $password = null)
17 17
     {
18
-        if (!UnifiedArchive::canOpen($file))
19
-            throw new \Exception('Could not open archive '.$file.'. Try installing suggested packages or run `cam -f` to see formats support.');
18
+        if (!UnifiedArchive::canOpen($file)) {
19
+                    throw new \Exception('Could not open archive '.$file.'. Try installing suggested packages or run `cam -f` to see formats support.');
20
+        }
20 21
 
21 22
         $archive = UnifiedArchive::open($file, $password);
22
-        if ($archive === null)
23
-            throw new \Exception('Could not open archive '.$file);
23
+        if ($archive === null) {
24
+                    throw new \Exception('Could not open archive '.$file);
25
+        }
24 26
 
25 27
         return $archive;
26 28
     }
@@ -33,17 +35,18 @@  discard block
 block discarded – undo
33 35
      */
34 36
     public function formatDate($unixtime)
35 37
     {
36
-        if (strtotime('today') < $unixtime)
37
-            return 'Today, '.date('G:m', $unixtime);
38
-        else if (strtotime('yesterday') < $unixtime)
39
-            return 'Yesterday, '.date('G:m', $unixtime);
40
-        else {
38
+        if (strtotime('today') < $unixtime) {
39
+                    return 'Today, '.date('G:m', $unixtime);
40
+        } else if (strtotime('yesterday') < $unixtime) {
41
+                    return 'Yesterday, '.date('G:m', $unixtime);
42
+        } else {
41 43
             $datetime = new \DateTime();
42 44
             $datetime->setTimestamp($unixtime);
43
-            if ($datetime->format('Y') == date('Y'))
44
-                return $datetime->format('d M, H:m');
45
-            else
46
-                return $datetime->format('d M Y, H:m');
45
+            if ($datetime->format('Y') == date('Y')) {
46
+                            return $datetime->format('d M, H:m');
47
+            } else {
48
+                            return $datetime->format('d M Y, H:m');
49
+            }
47 50
         }
48 51
     }
49 52
 
Please login to merge, or discard this patch.
src/Commands/BaseFileCommand.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,9 +37,9 @@
 block discarded – undo
37 37
             $question = new ChoiceQuestion('Which file', $files);
38 38
             $file = $helper->ask($input, $output, $question);
39 39
         } else if (!in_array($file, $files, true)) {
40
-            throw new \InvalidArgumentException('File "' . $file . '" not found in archive');
40
+            throw new \InvalidArgumentException('File "'.$file.'" not found in archive');
41 41
         }
42
-        $output->writeln('<comment>Selecting file ' . $file . '</comment>', OutputInterface::VERBOSITY_VERY_VERBOSE);
42
+        $output->writeln('<comment>Selecting file '.$file.'</comment>', OutputInterface::VERBOSITY_VERY_VERBOSE);
43 43
 
44 44
         return [$archive, $file];
45 45
     }
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,6 +33,6 @@
 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
 }
Please login to merge, or discard this patch.
src/Commands/BaseArchiveCommand.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -29,20 +29,20 @@
 block discarded – undo
29 29
     protected function getArchive(InputInterface $input, OutputInterface $output)
30 30
     {
31 31
         $file = realpath($input->getArgument('archive'));
32
-        $output->writeln('<comment>Opening ' . $file . '</comment>', OutputInterface::VERBOSITY_VERY_VERBOSE);
32
+        $output->writeln('<comment>Opening '.$file.'</comment>', OutputInterface::VERBOSITY_VERY_VERBOSE);
33 33
         if (!is_file($file)) {
34
-            throw new \InvalidArgumentException('File ' . $input->getArgument('archive') . ' is not accessible');
34
+            throw new \InvalidArgumentException('File '.$input->getArgument('archive').' is not accessible');
35 35
         }
36
-        $output->writeln('<comment>Format ' . Formats::detectArchiveFormat($file).'</comment>', OutputInterface::VERBOSITY_VERY_VERBOSE);
36
+        $output->writeln('<comment>Format '.Formats::detectArchiveFormat($file).'</comment>', OutputInterface::VERBOSITY_VERY_VERBOSE);
37 37
         $password = $input->getOption('password');
38 38
         if (empty($password)) {
39 39
             $password = null;
40 40
         } else {
41
-            $output->writeln('<comment>Passing password: ' . strlen($password).'</comment>', OutputInterface::VERBOSITY_VERY_VERBOSE);
41
+            $output->writeln('<comment>Passing password: '.strlen($password).'</comment>', OutputInterface::VERBOSITY_VERY_VERBOSE);
42 42
         }
43 43
         $archive = $this->open($file, $password);
44
-        $output->writeln('<comment>Driver ' . $archive->getDriverType() . '</comment>', OutputInterface::VERBOSITY_VERBOSE);
45
-        $output->writeln('<comment>Driver abilities: ' . implode(', ', $this->getDriverFormatAbilities($archive->getDriverType(), $archive->getFormat())) . '</comment>', OutputInterface::VERBOSITY_VERBOSE);
44
+        $output->writeln('<comment>Driver '.$archive->getDriverType().'</comment>', OutputInterface::VERBOSITY_VERBOSE);
45
+        $output->writeln('<comment>Driver abilities: '.implode(', ', $this->getDriverFormatAbilities($archive->getDriverType(), $archive->getFormat())).'</comment>', OutputInterface::VERBOSITY_VERBOSE);
46 46
         return $archive;
47 47
     }
48 48
 
Please login to merge, or discard this patch.
src/Commands/CreateCommand.php 2 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
         $password = $input->getOption('password');
48 48
         $compression = $input->getOption('compression');
49 49
         if (!isset(static::$compressionLevels[$compression])) {
50
-            throw new \InvalidArgumentException('Compression "' . $compression . '" is not valid');
50
+            throw new \InvalidArgumentException('Compression "'.$compression.'" is not valid');
51 51
         }
52 52
         $compression = static::$compressionLevels[$compression];
53 53
         $path = $input->getOption('path');
@@ -59,9 +59,9 @@  discard block
 block discarded – undo
59 59
 
60 60
         if (file_exists($archive_file)) {
61 61
             if (is_dir($archive_file))
62
-                throw new \InvalidArgumentException($archive_file . ' is a directory!');
62
+                throw new \InvalidArgumentException($archive_file.' is a directory!');
63 63
             else {
64
-                throw new \InvalidArgumentException('File "' . $archive_file . '" already exists!');
64
+                throw new \InvalidArgumentException('File "'.$archive_file.'" already exists!');
65 65
             }
66 66
         }
67 67
 
@@ -73,11 +73,11 @@  discard block
 block discarded – undo
73 73
                 case 'full':
74 74
                     $destination = ltrim($file_to_pack, '/');
75 75
                     $files_list[$destination] = $file_to_pack;
76
-                    $output->writeln('<comment>' . $file_to_pack . ' => ' . $destination . '</comment>', OutputInterface::VERBOSITY_VERBOSE);
76
+                    $output->writeln('<comment>'.$file_to_pack.' => '.$destination.'</comment>', OutputInterface::VERBOSITY_VERBOSE);
77 77
                     break;
78 78
                 case 'root':
79 79
                     if (is_dir($file_to_pack)) {
80
-                        $output->writeln('<comment>' . $file_to_pack . ' => root</comment>', OutputInterface::VERBOSITY_VERBOSE);
80
+                        $output->writeln('<comment>'.$file_to_pack.' => root</comment>', OutputInterface::VERBOSITY_VERBOSE);
81 81
                         if (!isset($files_list[''])) {
82 82
                             $files_list[''] = $file_to_pack;
83 83
                         } elseif (is_string($files_list[''])) {
@@ -86,35 +86,35 @@  discard block
 block discarded – undo
86 86
                             $files_list[''][] = $file_to_pack;
87 87
                         }
88 88
                     } else {
89
-                        $output->writeln('<comment>' . $file_to_pack . ' => ' . basename($file_to_pack) . '</comment>', OutputInterface::VERBOSITY_VERBOSE);
89
+                        $output->writeln('<comment>'.$file_to_pack.' => '.basename($file_to_pack).'</comment>', OutputInterface::VERBOSITY_VERBOSE);
90 90
                         $files_list[basename($file_to_pack)] = $file_to_pack;
91 91
                     }
92 92
                     break;
93 93
                 case 'relative':
94 94
                     $destination = ltrim($file_to_pack, '/.');
95 95
                     $files_list[$destination] = $file_to_pack;
96
-                    $output->writeln('<comment>' . $file_to_pack . ' => ' . $destination . '</comment>', OutputInterface::VERBOSITY_VERBOSE);
96
+                    $output->writeln('<comment>'.$file_to_pack.' => '.$destination.'</comment>', OutputInterface::VERBOSITY_VERBOSE);
97 97
                     break;
98 98
                 case 'basename':
99 99
                     $destination = basename($file_to_pack);
100 100
                     $files_list[$destination] = $file_to_pack;
101
-                    $output->writeln('<comment>' . $file_to_pack . ' => ' . $destination . '</comment>', OutputInterface::VERBOSITY_VERBOSE);
101
+                    $output->writeln('<comment>'.$file_to_pack.' => '.$destination.'</comment>', OutputInterface::VERBOSITY_VERBOSE);
102 102
                     break;
103 103
             }
104 104
         }
105 105
 
106 106
         $information = UnifiedArchive::prepareForArchiving($files_list, $archive_file);
107 107
         if ($dry_run) {
108
-            $output->writeln('Format: <info>' . $information['type'] . '</info>');
109
-            $output->writeln('Original size: <info>' . implode($this->formatSize($information['totalSize'])) . '</info>');
110
-            $output->writeln('Files: <info>' . $information['numberOfFiles'] . '</info>');
108
+            $output->writeln('Format: <info>'.$information['type'].'</info>');
109
+            $output->writeln('Original size: <info>'.implode($this->formatSize($information['totalSize'])).'</info>');
110
+            $output->writeln('Files: <info>'.$information['numberOfFiles'].'</info>');
111 111
             foreach ($information['files'] as $destination => $source) {
112 112
                 // is folder
113 113
                 if ($source === null) {
114 114
                     continue;
115 115
                 }
116 116
 
117
-                $output->writeln($source . ' => <comment>' . $destination . '</comment>');
117
+                $output->writeln($source.' => <comment>'.$destination.'</comment>');
118 118
             }
119 119
             return 0;
120 120
         }
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
         $progressBar = new ProgressBar($output, $information['numberOfFiles']);
125 125
         $progressBar->setFormat('archiving');
126 126
         $progressBar->start();
127
-        $archived_files = UnifiedArchive::archiveFiles($files_list, $archive_file, $compression, $password, function ($currentFile, $totalFiles, $fsFilename, $archiveFilename)
127
+        $archived_files = UnifiedArchive::archiveFiles($files_list, $archive_file, $compression, $password, function($currentFile, $totalFiles, $fsFilename, $archiveFilename)
128 128
             use ($progressBar) {
129 129
             $progressBar->advance();
130 130
             $progressBar->setMessage($fsFilename);
@@ -142,8 +142,8 @@  discard block
 block discarded – undo
142 142
             $archive->setComment($comment);
143 143
         }
144 144
 
145
-        $output->writeln('Created <info>' . $archive_file . '</info> with <comment>' . $archived_files . '</comment> file(s) ('
146
-                         . implode($this->formatSize($archive->getOriginalSize())) . ') of total size '
145
+        $output->writeln('Created <info>'.$archive_file.'</info> with <comment>'.$archived_files.'</comment> file(s) ('
146
+                         . implode($this->formatSize($archive->getOriginalSize())).') of total size '
147 147
                          . implode($this->formatSize(filesize($archive_file))));
148 148
     }
149 149
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -58,9 +58,9 @@
 block discarded – undo
58 58
         $comment = $input->getOption('comment');
59 59
 
60 60
         if (file_exists($archive_file)) {
61
-            if (is_dir($archive_file))
62
-                throw new \InvalidArgumentException($archive_file . ' is a directory!');
63
-            else {
61
+            if (is_dir($archive_file)) {
62
+                            throw new \InvalidArgumentException($archive_file . ' is a directory!');
63
+            } else {
64 64
                 throw new \InvalidArgumentException('File "' . $archive_file . '" already exists!');
65 65
             }
66 66
         }
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(['driver', 'open', 'stream', 'create', 'append', 'update', 'encrypt']);
Please login to merge, or discard this patch.