Passed
Push — master ( ae0184...ccf027 )
by f
13:17
created
src/LzwStreamWrapper.php 1 patch
Braces   +24 added lines, -15 removed lines patch added patch discarded remove patch
@@ -11,8 +11,9 @@  discard block
 block discarded – undo
11 11
      */
12 12
     public static function registerWrapper()
13 13
     {
14
-        if (!self::$registered)
15
-            stream_wrapper_register('compress.lzw', __CLASS__);
14
+        if (!self::$registered) {
15
+                    stream_wrapper_register('compress.lzw', __CLASS__);
16
+        }
16 17
         self::$registered = true;
17 18
     }
18 19
 
@@ -43,12 +44,14 @@  discard block
 block discarded – undo
43 44
     {
44 45
         // check for compress & uncompress utility
45 46
         $this->checkBinary();
46
-        if (self::$installed === false)
47
-            throw new \Exception('compress and uncompress commands are required');
47
+        if (self::$installed === false) {
48
+                    throw new \Exception('compress and uncompress commands are required');
49
+        }
48 50
 
49 51
         $schema = 'compress.lzw://';
50
-        if (strncasecmp($schema, $path, strlen($schema)) == 0)
51
-            $path = substr($path, strlen($schema));
52
+        if (strncasecmp($schema, $path, strlen($schema)) == 0) {
53
+                    $path = substr($path, strlen($schema));
54
+        }
52 55
 
53 56
         if (file_exists($path)) {
54 57
             $this->path = realpath($path);
@@ -62,14 +65,16 @@  discard block
 block discarded – undo
62 65
                 $this->read();
63 66
             } else {
64 67
                 $prefix = basename(__FILE__, '.php');
65
-                if (($tmp = tempnam(sys_get_temp_dir(), $prefix)) === false)
66
-                    throw new \Exception(__CLASS__.', line '.__LINE__.
68
+                if (($tmp = tempnam(sys_get_temp_dir(), $prefix)) === false) {
69
+                                    throw new \Exception(__CLASS__.', line '.__LINE__.
67 70
                         ': Could not create temporary file in '.
68 71
                         sys_get_temp_dir());
69
-                if (($tmp2 = tempnam(sys_get_temp_dir(), $prefix)) === false)
70
-                    throw new \Exception(__CLASS__.', line '.__LINE__.
72
+                }
73
+                if (($tmp2 = tempnam(sys_get_temp_dir(), $prefix)) === false) {
74
+                                    throw new \Exception(__CLASS__.', line '.__LINE__.
71 75
                         ': Could not create temporary file in '.
72 76
                         sys_get_temp_dir());
77
+                }
73 78
                 $this->tmp = $tmp;
74 79
                 $this->tmp2 = $tmp2;
75 80
                 $this->read();
@@ -78,14 +83,16 @@  discard block
 block discarded – undo
78 83
             $this->path = $path;
79 84
             if (self::$forceTmpFile) {
80 85
                 $prefix = basename(__FILE__, '.php');
81
-                if (($tmp = tempnam(sys_get_temp_dir(), $prefix)) === false)
82
-                    throw new \Exception(__CLASS__.', line '.__LINE__.
86
+                if (($tmp = tempnam(sys_get_temp_dir(), $prefix)) === false) {
87
+                                    throw new \Exception(__CLASS__.', line '.__LINE__.
83 88
                         ': Could not create temporary file in '.
84 89
                         sys_get_temp_dir());
85
-                if (($tmp2 = tempnam(sys_get_temp_dir(), $prefix)) === false)
86
-                    throw new \Exception(__CLASS__.', line '.__LINE__.
90
+                }
91
+                if (($tmp2 = tempnam(sys_get_temp_dir(), $prefix)) === false) {
92
+                                    throw new \Exception(__CLASS__.', line '.__LINE__.
87 93
                         ': Could not create temporary file in '.
88 94
                         sys_get_temp_dir());
95
+                }
89 96
                 $this->tmp = $tmp;
90 97
                 $this->tmp2 = $tmp2;
91 98
                 $this->pointer = 0;
@@ -266,7 +273,9 @@  discard block
 block discarded – undo
266 273
         }
267 274
         if ($this->tmp !== null) {
268 275
             unlink($this->tmp);
269
-            if (file_exists($this->tmp2)) unlink($this->tmp2);
276
+            if (file_exists($this->tmp2)) {
277
+             unlink($this->tmp2);
278
+            }
270 279
         } else {
271 280
             $this->data = null;
272 281
         }
Please login to merge, or discard this patch.
src/Archive7z.php 1 patch
Braces   +7 added lines, -6 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  discard block
 block discarded – undo
10 10
      */
11 11
     public static function getBinaryVersion()
12 12
     {
13
-        if (method_exists(__CLASS__, 'makeBinary7z'))
14
-            try {
13
+        if (method_exists(__CLASS__, 'makeBinary7z')) {
14
+                    try {
15 15
                 $binary = static::makeBinary7z();
16
+        }
16 17
             } catch (\Exception $e) {
17 18
                 return false;
18
-            }
19
-        else {
19
+            } else {
20 20
             // some hack for gemorroj/archive7z 4.x version
21 21
             try {
22 22
                 $seven_zip = new self(null);
@@ -29,8 +29,9 @@  discard block
 block discarded – undo
29 29
 
30 30
         $process = new Process([str_replace('\\', '/', $binary)]);
31 31
         $result = $process->mustRun()->getOutput();
32
-        if (!preg_match('~7-Zip (\([a-z]\) )?(\[[\d]+\] )?(?<version>\d+\.\d+)~i', $result, $version))
33
-            return false;
32
+        if (!preg_match('~7-Zip (\([a-z]\) )?(\[[\d]+\] )?(?<version>\d+\.\d+)~i', $result, $version)) {
33
+                    return false;
34
+        }
34 35
 
35 36
         return $version['version'];
36 37
     }
Please login to merge, or discard this patch.
src/Drivers/TarByPhar.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -203,8 +203,9 @@
 block discarded – undo
203 203
         $deleted = 0;
204 204
 
205 205
         foreach ($files as $i => $file) {
206
-            if ($this->tar->delete($file))
207
-                $deleted++;
206
+            if ($this->tar->delete($file)) {
207
+                            $deleted++;
208
+            }
208 209
         }
209 210
 
210 211
         $this->tar = null;
Please login to merge, or discard this patch.
src/Drivers/Rar.php 1 patch
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -100,7 +100,9 @@  discard block
 block discarded – undo
100 100
     {
101 101
         $information = new ArchiveInformation();
102 102
         foreach ($this->rar->getEntries() as $i => $entry) {
103
-            if ($entry->isDirectory()) continue;
103
+            if ($entry->isDirectory()) {
104
+             continue;
105
+            }
104 106
             $information->files[] = $entry->getName();
105 107
             $information->compressedFilesSize += $entry->getPackedSize();
106 108
             $information->uncompressedFilesSize += $entry->getUnpackedSize();
@@ -115,7 +117,9 @@  discard block
 block discarded – undo
115 117
     {
116 118
         $files = [];
117 119
         foreach ($this->rar->getEntries() as $i => $entry) {
118
-            if ($entry->isDirectory()) continue;
120
+            if ($entry->isDirectory()) {
121
+             continue;
122
+            }
119 123
             $files[] = $entry->getName();
120 124
         }
121 125
         return $files;
@@ -151,7 +155,9 @@  discard block
 block discarded – undo
151 155
     public function getFileContent($fileName)
152 156
     {
153 157
         $entry = $this->rar->getEntry($fileName);
154
-        if ($entry->isDirectory()) return false;
158
+        if ($entry->isDirectory()) {
159
+         return false;
160
+        }
155 161
         return stream_get_contents($entry->getStream());
156 162
     }
157 163
 
@@ -163,7 +169,9 @@  discard block
 block discarded – undo
163 169
     public function getFileStream($fileName)
164 170
     {
165 171
         $entry = $this->rar->getEntry($fileName);
166
-        if ($entry->isDirectory()) return false;
172
+        if ($entry->isDirectory()) {
173
+         return false;
174
+        }
167 175
         return $entry->getStream();
168 176
     }
169 177
 
Please login to merge, or discard this patch.
src/Commands/DetailsCommand.php 1 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/CreateCommand.php 1 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/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/AlchemyZippy.php 1 patch
Braces   +11 added lines, -8 removed lines patch added patch discarded remove patch
@@ -61,10 +61,11 @@  discard block
 block discarded – undo
61 61
 
62 62
     protected static function init()
63 63
     {
64
-        if (!class_exists('\Alchemy\Zippy\Zippy'))
65
-            static::$zippy = false;
66
-        else if (static::$zippy === null)
67
-            static::$zippy = Zippy::load();
64
+        if (!class_exists('\Alchemy\Zippy\Zippy')) {
65
+                    static::$zippy = false;
66
+        } else if (static::$zippy === null) {
67
+                    static::$zippy = Zippy::load();
68
+        }
68 69
     }
69 70
 
70 71
     /**
@@ -75,8 +76,9 @@  discard block
 block discarded – undo
75 76
     {
76 77
         static::init();
77 78
 
78
-        if (static::$zippy === false)
79
-            return [];
79
+        if (static::$zippy === false) {
80
+                    return [];
81
+        }
80 82
 
81 83
         switch ($format) {
82 84
             case Formats::TAR_BZIP:
@@ -212,8 +214,9 @@  discard block
 block discarded – undo
212 214
         $information = new ArchiveInformation();
213 215
 
214 216
         foreach ($this->archive->getMembers() as $member) {
215
-            if ($member->isDir())
216
-                continue;
217
+            if ($member->isDir()) {
218
+                            continue;
219
+            }
217 220
 
218 221
             $this->files[] = $information->files[] = str_replace('\\', '/', $member->getLocation());
219 222
             $this->members[str_replace('\\', '/', $member->getLocation())] = $member;
Please login to merge, or discard this patch.
src/Drivers/SevenZip.php 1 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.