Passed
Push — master ( 6a68be...839a13 )
by f
28:44 queued 13:48
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/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/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/PclZipInterface.php 1 patch
Braces   +99 added lines, -57 removed lines patch added patch discarded remove patch
@@ -137,8 +137,11 @@  discard block
 block discarded – undo
137 137
      */
138 138
     public function create($content)
139 139
     {
140
-        if (is_array($content)) $paths_list = $content;
141
-        else $paths_list = explode(',', $content);
140
+        if (is_array($content)) {
141
+         $paths_list = $content;
142
+        } else {
143
+         $paths_list = explode(',', $content);
144
+        }
142 145
 
143 146
         $options = $this->makeOptionsFromArguments(func_get_args());
144 147
 
@@ -146,8 +149,9 @@  discard block
 block discarded – undo
146 149
         $filters = $this->createFilters($options);
147 150
         list($preAddCallback, $postAddCallback) = $this->extractCallbacks($options, PCLZIP_CB_PRE_ADD, PCLZIP_CB_POST_ADD);
148 151
 
149
-        if (!empty($comment = $this->buildComment($options, null)))
150
-            $this->archive->setComment($comment);
152
+        if (!empty($comment = $this->buildComment($options, null))) {
153
+                    $this->archive->setComment($comment);
154
+        }
151 155
 
152 156
         // scan filesystem for files list
153 157
         return $this->addSnippets($paths_list, $filters, $preAddCallback, $postAddCallback);
@@ -167,16 +171,18 @@  discard block
 block discarded – undo
167 171
             $localname = $fileToAdd;
168 172
             $filename = $fileToAdd;
169 173
 
170
-            foreach ($filters as $filter)
171
-                call_user_func($filter, $localname, $filename);
174
+            foreach ($filters as $filter) {
175
+                            call_user_func($filter, $localname, $filename);
176
+            }
172 177
 
173 178
             $file_header = $this->createFileHeader($localname, $filename);
174 179
             if (call_user_func($preAddCallback, $file_header) == 1) {
175 180
                 //
176 181
                 // Check for max length > 255
177 182
                 //
178
-                if (strlen(basename($file_header->stored_filename)) > 255)
179
-                    $file_header->status = 'filename_too_long';
183
+                if (strlen(basename($file_header->stored_filename)) > 255) {
184
+                                    $file_header->status = 'filename_too_long';
185
+                }
180 186
                 if (is_file($filename)) {
181 187
                     $this->archive->addFiles([
182 188
                         $file_header->stored_filename => $file_header->filename,
@@ -248,27 +254,35 @@  discard block
 block discarded – undo
248 254
         }
249 255
 
250 256
         // filters initiation
251
-        if (isset($options[PCLZIP_OPT_PATH]))
252
-            $extractPath = rtrim($options[PCLZIP_OPT_PATH], '/');
253
-        else $extractPath = rtrim(getcwd(), '/');
257
+        if (isset($options[PCLZIP_OPT_PATH])) {
258
+                    $extractPath = rtrim($options[PCLZIP_OPT_PATH], '/');
259
+        } else {
260
+         $extractPath = rtrim(getcwd(), '/');
261
+        }
254 262
 
255 263
         $filters = $this->createFilters($options);
256 264
         list($preExtractCallback, $postExtractCallback) = $this->extractCallbacks($options, PCLZIP_CB_PRE_EXTRACT, PCLZIP_CB_POST_EXTRACT);
257 265
         $selectFilter = $this->createSelector($options);
258 266
 
259
-        if (isset($options[PCLZIP_OPT_EXTRACT_AS_STRING]))
260
-            $anotherOutputFormat = PCLZIP_OPT_EXTRACT_AS_STRING;
261
-        else if (isset($options[PCLZIP_OPT_EXTRACT_IN_OUTPUT]))
262
-            $anotherOutputFormat = PCLZIP_OPT_EXTRACT_IN_OUTPUT;
263
-        else $anotherOutputFormat = false;
267
+        if (isset($options[PCLZIP_OPT_EXTRACT_AS_STRING])) {
268
+                    $anotherOutputFormat = PCLZIP_OPT_EXTRACT_AS_STRING;
269
+        } else if (isset($options[PCLZIP_OPT_EXTRACT_IN_OUTPUT])) {
270
+                    $anotherOutputFormat = PCLZIP_OPT_EXTRACT_IN_OUTPUT;
271
+        } else {
272
+         $anotherOutputFormat = false;
273
+        }
264 274
 
265
-        if (isset($options[PCLZIP_OPT_REPLACE_NEWER]))
266
-            $doNotReplaceNewer = false;
267
-        else $doNotReplaceNewer = true;
275
+        if (isset($options[PCLZIP_OPT_REPLACE_NEWER])) {
276
+                    $doNotReplaceNewer = false;
277
+        } else {
278
+         $doNotReplaceNewer = true;
279
+        }
268 280
 
269
-        if (isset($options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION]))
270
-            $restrictExtractDir = $options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION];
271
-        else $restrictExtractDir = false;
281
+        if (isset($options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION])) {
282
+                    $restrictExtractDir = $options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION];
283
+        } else {
284
+         $restrictExtractDir = false;
285
+        }
272 286
 
273 287
         $report = array();
274 288
         foreach ($this->listContent() as $file_header) {
@@ -339,8 +353,10 @@  discard block
 block discarded – undo
339 353
             // extract content
340 354
             else if ($anotherOutputFormat === false) {
341 355
                 // apply path filters
342
-                foreach ($filters as $filter) call_user_func($filter,
356
+                foreach ($filters as $filter) {
357
+                 call_user_func($filter,
343 358
                     $file_header->stored_filename, $file_header->filename);
359
+                }
344 360
                 // dir extraction process
345 361
                 if ($file_header->folder) {
346 362
                     // if dir doesn't exist
@@ -431,15 +447,19 @@  discard block
 block discarded – undo
431 447
      */
432 448
     public function add($content)
433 449
     {
434
-        if (is_array($content)) $paths_list = $content;
435
-        else $paths_list = explode(',', $content);
450
+        if (is_array($content)) {
451
+         $paths_list = $content;
452
+        } else {
453
+         $paths_list = explode(',', $content);
454
+        }
436 455
 
437 456
         $options = $this->makeOptionsFromArguments(func_get_args());
438 457
         $filters = $this->createFilters($options);
439 458
         list($preAddCallback, $postAddCallback) = $this->extractCallbacks($options, PCLZIP_CB_PRE_ADD, PCLZIP_CB_POST_ADD);
440 459
 
441
-        if (!empty($comment = $this->buildComment($options, $this->archive->getComment())))
442
-            $this->archive->setComment($comment);
460
+        if (!empty($comment = $this->buildComment($options, $this->archive->getComment()))) {
461
+                    $this->archive->setComment($comment);
462
+        }
443 463
 
444 464
         // scan filesystem for files list
445 465
         return $this->addSnippets($paths_list, $filters, $preAddCallback, $postAddCallback);
@@ -511,8 +531,12 @@  discard block
 block discarded – undo
511 531
         }
512 532
 
513 533
         $tempDir = tempnam(PCLZIP_TEMPORARY_DIR, 'merging');
514
-        if (file_exists($tempDir)) unlink($tempDir);
515
-        if (!mkdir($tempDir)) return 0;
534
+        if (file_exists($tempDir)) {
535
+         unlink($tempDir);
536
+        }
537
+        if (!mkdir($tempDir)) {
538
+         return 0;
539
+        }
516 540
 
517 541
         // go through archive content list and copy all files
518 542
         foreach ($a->getFileNames() as $filename) {
@@ -541,8 +565,11 @@  discard block
 block discarded – undo
541 565
 
542 566
         call_user_func(function ($directory) {
543 567
             foreach (glob($directory.'/*') as $f) {
544
-                if (is_dir($f)) call_user_func(__FUNCTION__, $f);
545
-                else unlink($f);
568
+                if (is_dir($f)) {
569
+                 call_user_func(__FUNCTION__, $f);
570
+                } else {
571
+                 unlink($f);
572
+                }
546 573
             }
547 574
         }, $tempDir);
548 575
 
@@ -567,18 +594,21 @@  discard block
 block discarded – undo
567 594
     {
568 595
         $filters = array();
569 596
         if (isset($options[PCLZIP_OPT_REMOVE_PATH])
570
-            && !isset($options[PCLZIP_OPT_REMOVE_ALL_PATH]))
571
-            $filters[] = function (&$key, &$value) use ($options) {
597
+            && !isset($options[PCLZIP_OPT_REMOVE_ALL_PATH])) {
598
+                    $filters[] = function (&$key, &$value) use ($options) {
572 599
                 $key = str_replace($key, null, $key);
600
+        }
573 601
             };
574
-        if (isset($options[PCLZIP_OPT_REMOVE_ALL_PATH]))
575
-            $filters[] = function (&$key, &$value) {
602
+        if (isset($options[PCLZIP_OPT_REMOVE_ALL_PATH])) {
603
+                    $filters[] = function (&$key, &$value) {
576 604
                 $key = basename($key);
605
+        }
577 606
             };
578
-        if (isset($options[PCLZIP_OPT_ADD_PATH]))
579
-            $filters[] = function (&$key, &$value) use ($options) {
607
+        if (isset($options[PCLZIP_OPT_ADD_PATH])) {
608
+                    $filters[] = function (&$key, &$value) use ($options) {
580 609
                 $key = rtrim($options[PCLZIP_OPT_ADD_PATH], '/') . '/' .
581 610
                     ltrim($key, '/');
611
+        }
582 612
             };
583 613
         return $filters;
584 614
     }
@@ -593,11 +623,13 @@  discard block
 block discarded – undo
593 623
     {
594 624
         $preCallback = $postCallback = function () { return true; };
595 625
 
596
-        if (isset($options[$preCallbackConst]) && is_callable($options[$preCallbackConst]))
597
-            $preCallback = $options[$preCallbackConst];
626
+        if (isset($options[$preCallbackConst]) && is_callable($options[$preCallbackConst])) {
627
+                    $preCallback = $options[$preCallbackConst];
628
+        }
598 629
 
599
-        if (isset($options[$postCallbackConst]) && is_callable($options[$postCallbackConst]))
600
-            $postCallback = $options[$postCallbackConst];
630
+        if (isset($options[$postCallbackConst]) && is_callable($options[$postCallbackConst])) {
631
+                    $postCallback = $options[$postCallbackConst];
632
+        }
601 633
 
602 634
         return [$preCallback, $postCallback];
603 635
     }
@@ -610,7 +642,9 @@  discard block
 block discarded – undo
610 642
     {
611 643
         $keys = array_filter($options, function ($v) {return ($v%2) == 0;}, ARRAY_FILTER_USE_KEY);
612 644
         $values = array_filter($options, function ($v) {return ($v%2) == 1;}, ARRAY_FILTER_USE_KEY);
613
-        if (count($values) < count($keys)) $values[] = true;
645
+        if (count($values) < count($keys)) {
646
+         $values[] = true;
647
+        }
614 648
         return array_combine($keys, $values);
615 649
     }
616 650
 
@@ -653,9 +687,12 @@  discard block
 block discarded – undo
653 687
         $allowedIndexes = array();
654 688
         foreach ($indexes as $rule) {
655 689
             $parts = explode('-', $rule);
656
-            if (count($parts) == 1) $allowedIndexes[] = $rule;
657
-            else $allowedIndexes = array_merge(
690
+            if (count($parts) == 1) {
691
+             $allowedIndexes[] = $rule;
692
+            } else {
693
+             $allowedIndexes = array_merge(
658 694
                 range($parts[0], $parts[1]), $allowedIndexes);
695
+            }
659 696
         }
660 697
 
661 698
         return function ($key, $value, $index) use ($allowedIndexes) {
@@ -730,21 +767,26 @@  discard block
 block discarded – undo
730 767
     protected function createSelector(array $options)
731 768
     {
732 769
         // exact matching
733
-        if (isset($options[PCLZIP_OPT_BY_NAME]))
734
-            $selectFilter = $this->createByNameSelector($options[PCLZIP_OPT_BY_NAME]);
770
+        if (isset($options[PCLZIP_OPT_BY_NAME])) {
771
+                    $selectFilter = $this->createByNameSelector($options[PCLZIP_OPT_BY_NAME]);
772
+        }
735 773
         // <ereg> rule
736
-        else if (isset($options[PCLZIP_OPT_BY_EREG]) && function_exists('ereg'))
737
-            $selectFilter = $this->createByEregSelector($options[PCLZIP_OPT_BY_EREG]);
774
+        else if (isset($options[PCLZIP_OPT_BY_EREG]) && function_exists('ereg')) {
775
+                    $selectFilter = $this->createByEregSelector($options[PCLZIP_OPT_BY_EREG]);
776
+        }
738 777
         // <preg_match> rule
739
-        else if (isset($options[PCLZIP_OPT_BY_PREG]))
740
-            $selectFilter = $this->createByPregSelector($options[PCLZIP_OPT_BY_PREG]);
778
+        else if (isset($options[PCLZIP_OPT_BY_PREG])) {
779
+                    $selectFilter = $this->createByPregSelector($options[PCLZIP_OPT_BY_PREG]);
780
+        }
741 781
         // index rule
742
-        else if (isset($options[PCLZIP_OPT_BY_INDEX]))
743
-            $selectFilter = $this->createByIndexSelector($options[PCLZIP_OPT_BY_INDEX]);
782
+        else if (isset($options[PCLZIP_OPT_BY_INDEX])) {
783
+                    $selectFilter = $this->createByIndexSelector($options[PCLZIP_OPT_BY_INDEX]);
784
+        }
744 785
         // no rule
745
-        else
746
-            $selectFilter = function () {
786
+        else {
787
+                    $selectFilter = function () {
747 788
                 return self::SELECT_FILTER_PASS;
789
+        }
748 790
             };
749 791
         return $selectFilter;
750 792
     }
@@ -780,9 +822,9 @@  discard block
 block discarded – undo
780 822
     protected function buildComment(array $options, $currentComment)
781 823
     {
782 824
         $comment = null;
783
-        if (isset($options[PCLZIP_OPT_COMMENT]))
784
-            $comment = $options[PCLZIP_OPT_COMMENT];
785
-        else if (isset($options[PCLZIP_OPT_ADD_COMMENT])) {;
825
+        if (isset($options[PCLZIP_OPT_COMMENT])) {
826
+                    $comment = $options[PCLZIP_OPT_COMMENT];
827
+        } else if (isset($options[PCLZIP_OPT_ADD_COMMENT])) {;
786 828
             $comment = $currentComment . $options[PCLZIP_OPT_ADD_COMMENT];
787 829
         } else if (isset($options[PCLZIP_OPT_PREPEND_COMMENT])) {
788 830
             $comment = $options[PCLZIP_OPT_PREPEND_COMMENT] . $currentComment;
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.