Passed
Push — master ( 808e3e...9e3b5c )
by f
12:18
created
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/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/Zip.php 1 patch
Braces   +36 added lines, -24 removed lines patch added patch discarded remove patch
@@ -86,8 +86,9 @@  discard block
 block discarded – undo
86 86
     {
87 87
         parent::__construct($archiveFileName, $format);
88 88
         $this->open($archiveFileName);
89
-        if ($password !== null)
90
-            $this->zip->setPassword($password);
89
+        if ($password !== null) {
90
+                    $this->zip->setPassword($password);
91
+        }
91 92
     }
92 93
 
93 94
     /**
@@ -121,8 +122,9 @@  discard block
 block discarded – undo
121 122
         for ($i = 0; $i < $this->zip->numFiles; $i++) {
122 123
             $file = $this->zip->statIndex($i);
123 124
             // skip directories
124
-            if (in_array(substr($file['name'], -1), ['/', '\\'], true))
125
-                continue;
125
+            if (in_array(substr($file['name'], -1), ['/', '\\'], true)) {
126
+                            continue;
127
+            }
126 128
             $this->pureFilesNumber++;
127 129
             $information->files[$i] = $file['name'];
128 130
             $information->compressedFilesSize += $file['comp_size'];
@@ -157,8 +159,9 @@  discard block
 block discarded – undo
157 159
         for ($i = 0; $i < $this->zip->numFiles; $i++) {
158 160
             $file_name = $this->zip->getNameIndex($i);
159 161
             // skip directories
160
-            if (in_array(substr($file_name, -1), ['/', '\\'], true))
161
-                continue;
162
+            if (in_array(substr($file_name, -1), ['/', '\\'], true)) {
163
+                            continue;
164
+            }
162 165
             $files[] = $file_name;
163 166
         }
164 167
         return $files;
@@ -203,8 +206,9 @@  discard block
 block discarded – undo
203 206
     public function getFileContent($fileName)
204 207
     {
205 208
         $result = $this->zip->getFromName($fileName);
206
-        if ($result === false)
207
-            throw new Exception('Could not get file information: '.$result.'. May use password?');
209
+        if ($result === false) {
210
+                    throw new Exception('Could not get file information: '.$result.'. May use password?');
211
+        }
208 212
         return $result;
209 213
     }
210 214
 
@@ -225,8 +229,9 @@  discard block
 block discarded – undo
225 229
      */
226 230
     public function extractFiles($outputFolder, array $files)
227 231
     {
228
-        if ($this->zip->extractTo($outputFolder, $files) === false)
229
-            throw new ArchiveExtractionException($this->zip->getStatusString(), $this->zip->status);
232
+        if ($this->zip->extractTo($outputFolder, $files) === false) {
233
+                    throw new ArchiveExtractionException($this->zip->getStatusString(), $this->zip->status);
234
+        }
230 235
 
231 236
         return count($files);
232 237
     }
@@ -238,8 +243,9 @@  discard block
 block discarded – undo
238 243
      */
239 244
     public function extractArchive($outputFolder)
240 245
     {
241
-        if ($this->zip->extractTo($outputFolder) === false)
242
-            throw new ArchiveExtractionException($this->zip->getStatusString(), $this->zip->status);
246
+        if ($this->zip->extractTo($outputFolder) === false) {
247
+                    throw new ArchiveExtractionException($this->zip->getStatusString(), $this->zip->status);
248
+        }
243 249
 
244 250
         return $this->pureFilesNumber;
245 251
     }
@@ -254,8 +260,9 @@  discard block
 block discarded – undo
254 260
     {
255 261
         $count = 0;
256 262
         foreach ($files as $file) {
257
-            if ($this->zip->deleteName($file) === false)
258
-                throw new ArchiveModificationException($this->zip->getStatusString(), $this->zip->status);
263
+            if ($this->zip->deleteName($file) === false) {
264
+                            throw new ArchiveModificationException($this->zip->getStatusString(), $this->zip->status);
265
+            }
259 266
             $count++;
260 267
         }
261 268
 
@@ -278,11 +285,13 @@  discard block
 block discarded – undo
278 285
         $added_files = 0;
279 286
         foreach ($files as $localName => $fileName) {
280 287
             if (is_null($fileName)) {
281
-                if ($this->zip->addEmptyDir($localName) === false)
282
-                    throw new ArchiveModificationException($this->zip->getStatusString(), $this->zip->status);
288
+                if ($this->zip->addEmptyDir($localName) === false) {
289
+                                    throw new ArchiveModificationException($this->zip->getStatusString(), $this->zip->status);
290
+                }
283 291
             } else {
284
-                if ($this->zip->addFile($fileName, $localName) === false)
285
-                    throw new ArchiveModificationException($this->zip->getStatusString(), $this->zip->status);
292
+                if ($this->zip->addFile($fileName, $localName) === false) {
293
+                                    throw new ArchiveModificationException($this->zip->getStatusString(), $this->zip->status);
294
+                }
286 295
                 $added_files++;
287 296
             }
288 297
         }
@@ -335,8 +344,9 @@  discard block
 block discarded – undo
335 344
         $zip = new ZipArchive();
336 345
         $result = $zip->open($archiveFileName, ZipArchive::CREATE);
337 346
 
338
-        if ($result !== true)
339
-            throw new ArchiveCreationException('ZipArchive error: '.$result);
347
+        if ($result !== true) {
348
+                    throw new ArchiveCreationException('ZipArchive error: '.$result);
349
+        }
340 350
 
341 351
         $can_set_compression_level = method_exists($zip, 'setCompressionName');
342 352
         $can_encrypt = static::canEncrypt(Formats::ZIP);
@@ -354,11 +364,13 @@  discard block
 block discarded – undo
354 364
 
355 365
         foreach ($files as $localName => $fileName) {
356 366
             if ($fileName === null) {
357
-                if ($zip->addEmptyDir($localName) === false)
358
-                    throw new ArchiveCreationException('Could not archive directory "'.$localName.'": '.$zip->getStatusString(), $zip->status);
367
+                if ($zip->addEmptyDir($localName) === false) {
368
+                                    throw new ArchiveCreationException('Could not archive directory "'.$localName.'": '.$zip->getStatusString(), $zip->status);
369
+                }
359 370
             } else {
360
-                if ($zip->addFile($fileName, $localName) === false)
361
-                    throw new ArchiveCreationException('Could not archive file "'.$fileName.'": '.$zip->getStatusString(), $zip->status);
371
+                if ($zip->addFile($fileName, $localName) === false) {
372
+                                    throw new ArchiveCreationException('Could not archive file "'.$fileName.'": '.$zip->getStatusString(), $zip->status);
373
+                }
362 374
                 if ($can_set_compression_level) {
363 375
                     $zip->setCompressionName($localName, $compressionLevelMap[$compressionLevel]);
364 376
                 }
Please login to merge, or discard this patch.
src/Drivers/Cab.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -82,8 +82,9 @@
 block discarded – undo
82 82
     public function __construct($archiveFileName, $format, $password = null)
83 83
     {
84 84
         parent::__construct($archiveFileName, $format);
85
-        if ($password !== null)
86
-            throw new UnsupportedOperationException('Cab archive does not support password!');
85
+        if ($password !== null) {
86
+                    throw new UnsupportedOperationException('Cab archive does not support password!');
87
+        }
87 88
         $this->open($archiveFileName);
88 89
     }
89 90
 
Please login to merge, or discard this patch.
src/Drivers/Iso.php 1 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.