Passed
Push — master ( 125b29...554a92 )
by f
27:06 queued 12:02
created
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/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
@@ -130,8 +132,9 @@  discard block
 block discarded – undo
130 132
             if ($files) {
131 133
                 /** @var \CFileDirDescriptors $file */
132 134
                 foreach ($files as $file) {
133
-                    if (in_array($file->strd_FileId, ['.', '..']) || $file->IsDirectory())
134
-                        continue;
135
+                    if (in_array($file->strd_FileId, ['.', '..']) || $file->IsDirectory()) {
136
+                                            continue;
137
+                    }
135 138
                     $this->files[$file->Location] = $directory.$file->strd_FileId;
136 139
                     $this->filesSize += $file->DataLen;
137 140
 
@@ -183,8 +186,9 @@  discard block
 block discarded – undo
183 186
      */
184 187
     public function getFileData($fileName)
185 188
     {
186
-        if (!isset($this->filesData[$fileName]))
187
-            return false;
189
+        if (!isset($this->filesData[$fileName])) {
190
+                    return false;
191
+        }
188 192
 
189 193
         return new ArchiveEntry($fileName, $this->filesData[$fileName]['size'],
190 194
             $this->filesData[$fileName]['size'], $this->filesData[$fileName]['mtime'],false);
@@ -219,11 +223,14 @@  discard block
 block discarded – undo
219 223
     protected function prepareForFileExtracting($fileName)
220 224
     {
221 225
         $Location = array_search($fileName, $this->files, true);
222
-        if (!isset($this->filesData[$fileName])) return false;
226
+        if (!isset($this->filesData[$fileName])) {
227
+         return false;
228
+        }
223 229
         $data = $this->filesData[$fileName];
224 230
         $Location_Real = $Location * $this->blockSize;
225
-        if ($this->iso->Seek($Location_Real, SEEK_SET) === false)
226
-            return false;
231
+        if ($this->iso->Seek($Location_Real, SEEK_SET) === false) {
232
+                    return false;
233
+        }
227 234
         return $data;
228 235
     }
229 236
 
Please login to merge, or discard this patch.
src/Drivers/OneFile/OneFileDriver.php 1 patch
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -59,10 +59,12 @@  discard block
 block discarded – undo
59 59
      */
60 60
     public function __construct($archiveFileName, $format, $password = null)
61 61
     {
62
-        if (static::FORMAT_SUFFIX === null)
63
-            throw new \Exception('Format should be initialized');
64
-        if ($password !== null)
65
-            throw new UnsupportedOperationException(self::FORMAT_SUFFIX.' archive does not support password!');
62
+        if (static::FORMAT_SUFFIX === null) {
63
+                    throw new \Exception('Format should be initialized');
64
+        }
65
+        if ($password !== null) {
66
+                    throw new UnsupportedOperationException(self::FORMAT_SUFFIX.' archive does not support password!');
67
+        }
66 68
 
67 69
         parent::__construct($archiveFileName, $format);
68 70
 
@@ -131,8 +133,9 @@  discard block
 block discarded – undo
131 133
     public function extractArchive($outputFolder)
132 134
     {
133 135
         $data = $this->getFileContent($this->inArchiveFileName);
134
-        if ($data === false)
135
-            throw new ArchiveExtractionException('Could not extract archive');
136
+        if ($data === false) {
137
+                    throw new ArchiveExtractionException('Could not extract archive');
138
+        }
136 139
 
137 140
         $size = strlen($data);
138 141
         $written = file_put_contents($outputFolder.$this->inArchiveFileName, $data);
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/Commands/InfoCommand.php 1 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.