Passed
Push — master ( 2af7c1...77631b )
by f
03:12
created
src/Drivers/SevenZip.php 1 patch
Braces   +30 added lines, -20 removed lines patch added patch discarded remove patch
@@ -57,12 +57,14 @@  discard block
 block discarded – undo
57 57
     public static function checkFormatSupport($format)
58 58
     {
59 59
         $available = class_exists('\Archive7z\Archive7z') && Archive7z::getBinaryVersion() !== false;
60
-        if (!$available)
61
-            return false;
60
+        if (!$available) {
61
+                    return false;
62
+        }
62 63
 
63 64
         // in 4.0.0 version it was supporting only 7z
64
-        if (!Archive7z::supportsAllFormats())
65
-            return $format === Formats::SEVEN_ZIP;
65
+        if (!Archive7z::supportsAllFormats()) {
66
+                    return $format === Formats::SEVEN_ZIP;
67
+        }
66 68
 
67 69
         switch ($format) {
68 70
             case Formats::SEVEN_ZIP:
@@ -103,11 +105,13 @@  discard block
 block discarded – undo
103 105
      */
104 106
     public static function getInstallationInstruction()
105 107
     {
106
-        if (!class_exists('\Archive7z\Archive7z'))
107
-            return 'install library `gemorroj/archive7z` and console program p7zip (7za)';
108
+        if (!class_exists('\Archive7z\Archive7z')) {
109
+                    return 'install library `gemorroj/archive7z` and console program p7zip (7za)';
110
+        }
108 111
 
109
-        if (Archive7z::getBinaryVersion() === false)
110
-            return 'install console program p7zip (7za)';
112
+        if (Archive7z::getBinaryVersion() === false) {
113
+                    return 'install console program p7zip (7za)';
114
+        }
111 115
 
112 116
         return null;
113 117
     }
@@ -120,8 +124,9 @@  discard block
 block discarded – undo
120 124
         try {
121 125
             $this->format = $format;
122 126
             $this->sevenZip = new Archive7z($archiveFileName, null, null);
123
-            if ($password !== null)
124
-                $this->sevenZip->setPassword($password);
127
+            if ($password !== null) {
128
+                            $this->sevenZip->setPassword($password);
129
+            }
125 130
         } catch (\Archive7z\Exception $e) {
126 131
             throw new Exception('Could not open 7Zip archive: '.$e->getMessage(), $e->getCode(), $e);
127 132
         }
@@ -139,8 +144,9 @@  discard block
 block discarded – undo
139 144
                 continue;
140 145
             }
141 146
 
142
-            if (!isset($can_get_unix_path))
143
-                $can_get_unix_path = method_exists($entry, 'getUnixPath');
147
+            if (!isset($can_get_unix_path)) {
148
+                            $can_get_unix_path = method_exists($entry, 'getUnixPath');
149
+            }
144 150
 
145 151
             $information->files[] = $can_get_unix_path
146 152
                 ? $entry->getUnixPath()
@@ -158,8 +164,9 @@  discard block
 block discarded – undo
158 164
     {
159 165
         $files = [];
160 166
         foreach ($this->sevenZip->getEntries() as $entry) {
161
-            if ($entry->isDirectory())
162
-                continue;
167
+            if ($entry->isDirectory()) {
168
+                            continue;
169
+            }
163 170
             $files[] = $entry->getPath();
164 171
         }
165 172
         return $files;
@@ -300,8 +307,9 @@  discard block
 block discarded – undo
300 307
     public function addFileFromString($inArchiveName, $content)
301 308
     {
302 309
         $tmp_file = tempnam(sys_get_temp_dir(), 'ua');
303
-        if (!$tmp_file)
304
-            throw new ArchiveModificationException('Could not create temporarily file');
310
+        if (!$tmp_file) {
311
+                    throw new ArchiveModificationException('Could not create temporarily file');
312
+        }
305 313
 
306 314
         file_put_contents($tmp_file, $content);
307 315
         $this->sevenZip->addEntry($tmp_file, true);
@@ -330,8 +338,9 @@  discard block
 block discarded – undo
330 338
 
331 339
         try {
332 340
             $seven_zip = new Archive7z($archiveFileName);
333
-            if ($password !== null)
334
-                $seven_zip->setPassword($password);
341
+            if ($password !== null) {
342
+                            $seven_zip->setPassword($password);
343
+            }
335 344
             $seven_zip->setCompressionLevel($compressionLevelMap[$compressionLevel]);
336 345
             foreach ($files as $localName => $filename) {
337 346
                 if ($filename !== null) {
@@ -360,8 +369,9 @@  discard block
 block discarded – undo
360 369
             Formats::TAR,
361 370
             Formats::LZMA,
362 371
             Formats::ZIP]
363
-        ))
364
-            return self::canRenameFiles();
372
+        )) {
373
+                    return self::canRenameFiles();
374
+        }
365 375
 
366 376
         return false;
367 377
     }
Please login to merge, or discard this patch.