Passed
Pull Request — master (#242)
by
unknown
02:35
created
rector.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -5,8 +5,8 @@
 block discarded – undo
5 5
 use Rector\Config\RectorConfig;
6 6
 use Rector\Set\ValueObject\SetList;
7 7
 
8
-return static function (RectorConfig $containerConfigurator): void {
9
-    $containerConfigurator->paths([__DIR__ . '/src', __DIR__ . '/tests']);
8
+return static function(RectorConfig $containerConfigurator): void {
9
+    $containerConfigurator->paths([__DIR__.'/src', __DIR__.'/tests']);
10 10
 
11 11
     $containerConfigurator->import(SetList::PHP_54);
12 12
     $containerConfigurator->import(SetList::PHP_55);
Please login to merge, or discard this patch.
src/Header.php 2 patches
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 
96 96
         }
97 97
 
98
-        throw new MethodNotFoundException("Method " . self::class . '::' . $method . '() is not supported');
98
+        throw new MethodNotFoundException("Method ".self::class.'::'.$method.'() is not supported');
99 99
     }
100 100
 
101 101
     /**
@@ -130,20 +130,20 @@  discard block
 block discarded – undo
130 130
         if (isset($this->attributes[$name]) && $strict === false) {
131 131
             if ($this->attributize) {
132 132
                 $this->attributes[$name]->add($value, true);
133
-            } else {
133
+            }else {
134 134
                 if (isset($this->attributes[$name])) {
135 135
                     if (!is_array($this->attributes[$name])) {
136 136
                         $this->attributes[$name] = [$this->attributes[$name], $value];
137
-                    } else {
137
+                    }else {
138 138
                         $this->attributes[$name][] = $value;
139 139
                     }
140
-                } else {
140
+                }else {
141 141
                     $this->attributes[$name] = $value;
142 142
                 }
143 143
             }
144 144
         } elseif (!$this->attributize) {
145 145
             $this->attributes[$name] = $value;
146
-        } else {
146
+        }else {
147 147
             $this->attributes[$name] = new Attribute($name, $value);
148 148
         }
149 149
 
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
         $headers = [];
236 236
         $imap_headers = [];
237 237
         if (extension_loaded('imap') && $this->config["rfc822"]) {
238
-            $raw_imap_headers = (array)imap_rfc822_parse_headers($this->raw);
238
+            $raw_imap_headers = (array) imap_rfc822_parse_headers($this->raw);
239 239
             foreach ($raw_imap_headers as $key => $values) {
240 240
                 $key = str_replace("-", "_", $key);
241 241
                 $imap_headers[$key] = $values;
@@ -263,11 +263,11 @@  discard block
 block discarded – undo
263 263
                     }
264 264
                     if (is_array($headers[$prev_header])) {
265 265
                         $headers[$prev_header][] = $line;
266
-                    } else {
266
+                    }else {
267 267
                         $headers[$prev_header] .= $line;
268 268
                     }
269 269
                 }
270
-            } else {
270
+            }else {
271 271
                 if (($pos = strpos($line, ":")) > 0) {
272 272
                     $key = trim(rtrim(strtolower(substr($line, 0, $pos))));
273 273
                     $key = str_replace("-", "_", $key);
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
                     $value = trim(rtrim(substr($line, $pos + 1)));
276 276
                     if (isset($headers[$key])) {
277 277
                         $headers[$key][] = $value;
278
-                    } else {
278
+                    }else {
279 279
                         $headers[$key] = [$value];
280 280
                     }
281 281
                     $prev_header = $key;
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
                 case 'reply_to':
295 295
                 case 'sender':
296 296
                     $value = $this->decodeAddresses($values);
297
-                    $headers[$key . "address"] = implode(", ", $values);
297
+                    $headers[$key."address"] = implode(", ", $values);
298 298
                     break;
299 299
                 case 'subject':
300 300
                     $value = implode(" ", $values);
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
                             $value = implode(" ", $values);
314 314
                         } elseif ($available_values > 2) {
315 315
                             $value = array_values($values);
316
-                        } else {
316
+                        }else {
317 317
                             $value = "";
318 318
                         }
319 319
                     }
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
             $headers[$key] = $value;
323 323
         }
324 324
 
325
-        return (object)array_merge($headers, $imap_headers);
325
+        return (object) array_merge($headers, $imap_headers);
326 326
     }
327 327
 
328 328
     /**
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
             return imap_mime_header_decode($text);
339 339
         }
340 340
         $charset = $this->getEncoding($text);
341
-        return [(object)[
341
+        return [(object) [
342 342
             "charset" => $charset,
343 343
             "text"    => $this->convertEncoding($text, $charset)
344 344
         ]];
@@ -501,7 +501,7 @@  discard block
 block discarded – undo
501 501
      */
502 502
     private function findPriority(): void {
503 503
         if (($priority = $this->get("x_priority")) === null) return;
504
-        switch ((int)"$priority") {
504
+        switch ((int) "$priority") {
505 505
             case IMAP::MESSAGE_PRIORITY_HIGHEST;
506 506
                 $priority = IMAP::MESSAGE_PRIORITY_HIGHEST;
507 507
                 break;
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
                     if (isset($parsed_address['address'])) {
541 541
                         $mail_address = explode('@', $parsed_address['address']);
542 542
                         if (count($mail_address) == 2) {
543
-                            $addresses[] = (object)[
543
+                            $addresses[] = (object) [
544 544
                                 "personal" => $parsed_address['display'] ?? '',
545 545
                                 "mailbox"  => $mail_address[0],
546 546
                                 "host"     => $mail_address[1],
@@ -568,7 +568,7 @@  discard block
 block discarded – undo
568 568
                     $name = trim(rtrim($matches["name"]));
569 569
                     $email = trim(rtrim($matches["email"]));
570 570
                     [$mailbox, $host] = array_pad(explode("@", $email), 2, null);
571
-                    $addresses[] = (object)[
571
+                    $addresses[] = (object) [
572 572
                         "personal" => $name,
573 573
                         "mailbox"  => $mailbox,
574 574
                         "host"     => $host,
@@ -605,7 +605,7 @@  discard block
 block discarded – undo
605 605
         }
606 606
 
607 607
         foreach ($list as $item) {
608
-            $address = (object)$item;
608
+            $address = (object) $item;
609 609
 
610 610
             if (!property_exists($address, 'mailbox')) {
611 611
                 $address->mailbox = false;
@@ -615,7 +615,7 @@  discard block
 block discarded – undo
615 615
             }
616 616
             if (!property_exists($address, 'personal')) {
617 617
                 $address->personal = false;
618
-            } else {
618
+            }else {
619 619
                 $personalParts = $this->mime_header_decode($address->personal);
620 620
 
621 621
                 if (is_array($personalParts)) {
@@ -630,8 +630,8 @@  discard block
 block discarded – undo
630 630
                 }
631 631
             }
632 632
 
633
-            $address->mail = ($address->mailbox && $address->host) ? $address->mailbox . '@' . $address->host : false;
634
-            $address->full = ($address->personal) ? $address->personal . ' <' . $address->mail . '>' : $address->mail;
633
+            $address->mail = ($address->mailbox && $address->host) ? $address->mailbox.'@'.$address->host : false;
634
+            $address->full = ($address->personal) ? $address->personal.' <'.$address->mail.'>' : $address->mail;
635 635
 
636 636
             $addresses[] = new Address($address);
637 637
         }
@@ -646,8 +646,8 @@  discard block
 block discarded – undo
646 646
         foreach ($this->attributes as $key => $value) {
647 647
             if (is_array($value)) {
648 648
                 $value = implode(", ", $value);
649
-            } else {
650
-                $value = (string)$value;
649
+            }else {
650
+                $value = (string) $value;
651 651
             }
652 652
             // Only parse strings and don't parse any attributes like the user-agent
653 653
             if (($key == "user_agent") === false) {
@@ -726,7 +726,7 @@  discard block
 block discarded – undo
726 726
                     $parsed_date = Carbon::parse($date);
727 727
                 } catch (Exception $_e) {
728 728
                     if (!isset($this->config["fallback_date"])) {
729
-                        throw new InvalidMessageDateException("Invalid message date. ID:" . $this->get("message_id") . " Date:" . $header->date . "/" . $date, 1100, $e);
729
+                        throw new InvalidMessageDateException("Invalid message date. ID:".$this->get("message_id")." Date:".$header->date."/".$date, 1100, $e);
730 730
                     }
731 731
                     $parsed_date = Carbon::parse($this->config["fallback_date"]);
732 732
                 }
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -284,7 +284,9 @@  discard block
 block discarded – undo
284 284
         }
285 285
 
286 286
         foreach ($headers as $key => $values) {
287
-            if (isset($imap_headers[$key])) continue;
287
+            if (isset($imap_headers[$key])) {
288
+                continue;
289
+            }
288 290
             $value = null;
289 291
             switch ($key) {
290 292
                 case 'from':
@@ -500,7 +502,9 @@  discard block
 block discarded – undo
500 502
      * Try to extract the priority from a given raw header string
501 503
      */
502 504
     private function findPriority(): void {
503
-        if (($priority = $this->get("x_priority")) === null) return;
505
+        if (($priority = $this->get("x_priority")) === null) {
506
+            return;
507
+        }
504 508
         switch ((int)"$priority") {
505 509
             case IMAP::MESSAGE_PRIORITY_HIGHEST;
506 510
                 $priority = IMAP::MESSAGE_PRIORITY_HIGHEST;
Please login to merge, or discard this patch.
src/Structure.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -79,9 +79,9 @@  discard block
 block discarded – undo
79 79
     public function findContentType(): void{
80 80
         $content_type = $this->header->get("content_type");
81 81
         $content_type = is_array($content_type) ? implode(' ', $content_type) : $content_type;
82
-        if(stripos($content_type, 'multipart') === 0) {
82
+        if (stripos($content_type, 'multipart') === 0) {
83 83
             $this->type = IMAP::MESSAGE_TYPE_MULTIPART;
84
-        }else{
84
+        }else {
85 85
             $this->type = IMAP::MESSAGE_TYPE_TEXT;
86 86
         }
87 87
     }
@@ -118,9 +118,9 @@  discard block
 block discarded – undo
118 118
      * @throws InvalidMessageDateException
119 119
      */
120 120
     private function detectParts(string $boundary, string $context, int $part_number = 0): array {
121
-        $base_parts = explode( $boundary, $context);
121
+        $base_parts = explode($boundary, $context);
122 122
         $final_parts = [];
123
-        foreach($base_parts as $ctx) {
123
+        foreach ($base_parts as $ctx) {
124 124
             $ctx = substr($ctx, 2);
125 125
             if ($ctx !== "--" && $ctx != "") {
126 126
                 $parts = $this->parsePart($ctx, $part_number);
@@ -142,8 +142,8 @@  discard block
 block discarded – undo
142 142
      * @throws InvalidMessageDateException
143 143
      */
144 144
     public function find_parts(): array {
145
-        if($this->type === IMAP::MESSAGE_TYPE_MULTIPART) {
146
-            if (($boundary = $this->header->getBoundary()) === null)  {
145
+        if ($this->type === IMAP::MESSAGE_TYPE_MULTIPART) {
146
+            if (($boundary = $this->header->getBoundary()) === null) {
147 147
                 throw new MessageContentFetchingException("no content found", 0);
148 148
             }
149 149
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@
 block discarded – undo
81 81
         $content_type = is_array($content_type) ? implode(' ', $content_type) : $content_type;
82 82
         if(stripos($content_type, 'multipart') === 0) {
83 83
             $this->type = IMAP::MESSAGE_TYPE_MULTIPART;
84
-        }else{
84
+        } else{
85 85
             $this->type = IMAP::MESSAGE_TYPE_TEXT;
86 86
         }
87 87
     }
Please login to merge, or discard this patch.
src/ClientManager.php 2 patches
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -76,17 +76,17 @@  discard block
 block discarded – undo
76 76
     public static function get(string $key, $default = null) {
77 77
         $parts = explode('.', $key);
78 78
         $value = null;
79
-        foreach($parts as $part) {
80
-            if($value === null) {
81
-                if(isset(self::$config[$part])) {
79
+        foreach ($parts as $part) {
80
+            if ($value === null) {
81
+                if (isset(self::$config[$part])) {
82 82
                     $value = self::$config[$part];
83
-                }else{
83
+                }else {
84 84
                     break;
85 85
                 }
86
-            }else{
87
-                if(isset($value[$part])) {
86
+            }else {
87
+                if (isset($value[$part])) {
88 88
                     $value = $value[$part];
89
-                }else{
89
+                }else {
90 90
                     break;
91 91
                 }
92 92
             }
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
      */
175 175
     public function setConfig($config): self {
176 176
 
177
-        if(is_array($config) === false) {
177
+        if (is_array($config) === false) {
178 178
             $config = require $config;
179 179
         }
180 180
 
@@ -184,17 +184,17 @@  discard block
 block discarded – undo
184 184
         $vendor_config = require $path;
185 185
         $config = $this->array_merge_recursive_distinct($vendor_config, $config);
186 186
 
187
-        if(is_array($config)){
188
-            if(isset($config['default'])){
189
-                if(isset($config['accounts']) && $config['default'] != false){
187
+        if (is_array($config)) {
188
+            if (isset($config['default'])) {
189
+                if (isset($config['accounts']) && $config['default'] != false) {
190 190
 
191 191
                     $default_config = $vendor_config['accounts']['default'];
192
-                    if(isset($config['accounts'][$config['default']])){
192
+                    if (isset($config['accounts'][$config['default']])) {
193 193
                         $default_config = array_merge($default_config, $config['accounts'][$config['default']]);
194 194
                     }
195 195
 
196
-                    if(is_array($config['accounts'])){
197
-                        foreach($config['accounts'] as $account_key => $account){
196
+                    if (is_array($config['accounts'])) {
197
+                        foreach ($config['accounts'] as $account_key => $account) {
198 198
                             $config['accounts'][$account_key] = array_merge($default_config, $account);
199 199
                         }
200 200
                     }
@@ -233,20 +233,20 @@  discard block
 block discarded – undo
233 233
             return array_keys($arr) !== range(0, count($arr) - 1);
234 234
         };
235 235
 
236
-        if(!is_array($base)) $base = empty($base) ? array() : array($base);
236
+        if (!is_array($base)) $base = empty($base) ? array() : array($base);
237 237
 
238
-        foreach($arrays as $append) {
238
+        foreach ($arrays as $append) {
239 239
 
240
-            if(!is_array($append)) $append = array($append);
240
+            if (!is_array($append)) $append = array($append);
241 241
 
242
-            foreach($append as $key => $value) {
242
+            foreach ($append as $key => $value) {
243 243
 
244
-                if(!array_key_exists($key, $base) and !is_numeric($key)) {
244
+                if (!array_key_exists($key, $base) and !is_numeric($key)) {
245 245
                     $base[$key] = $value;
246 246
                     continue;
247 247
                 }
248 248
 
249
-                if(
249
+                if (
250 250
                     (
251 251
                         is_array($value)
252 252
                         && $isAssoc($value)
@@ -260,9 +260,9 @@  discard block
 block discarded – undo
260 260
                     // else merging $baseConfig['dispositions'] = ['attachment', 'inline'] with $customConfig['dispositions'] = ['attachment']
261 261
                     // results in $resultConfig['dispositions'] = ['attachment', 'inline']
262 262
                     $base[$key] = $this->array_merge_recursive_distinct($base[$key], $value);
263
-                } else if(is_numeric($key)) {
264
-                    if(!in_array($value, $base)) $base[] = $value;
265
-                } else {
263
+                }else if (is_numeric($key)) {
264
+                    if (!in_array($value, $base)) $base[] = $value;
265
+                }else {
266 266
                     $base[$key] = $value;
267 267
                 }
268 268
 
Please login to merge, or discard this patch.
Braces   +15 added lines, -7 removed lines patch added patch discarded remove patch
@@ -80,13 +80,13 @@  discard block
 block discarded – undo
80 80
             if($value === null) {
81 81
                 if(isset(self::$config[$part])) {
82 82
                     $value = self::$config[$part];
83
-                }else{
83
+                } else{
84 84
                     break;
85 85
                 }
86
-            }else{
86
+            } else{
87 87
                 if(isset($value[$part])) {
88 88
                     $value = $value[$part];
89
-                }else{
89
+                } else{
90 90
                     break;
91 91
                 }
92 92
             }
@@ -229,15 +229,21 @@  discard block
 block discarded – undo
229 229
 
230 230
         // From https://stackoverflow.com/a/173479
231 231
         $isAssoc = function(array $arr): bool {
232
-            if (array() === $arr) return false;
232
+            if (array() === $arr) {
233
+                return false;
234
+            }
233 235
             return array_keys($arr) !== range(0, count($arr) - 1);
234 236
         };
235 237
 
236
-        if(!is_array($base)) $base = empty($base) ? array() : array($base);
238
+        if(!is_array($base)) {
239
+            $base = empty($base) ? array() : array($base);
240
+        }
237 241
 
238 242
         foreach($arrays as $append) {
239 243
 
240
-            if(!is_array($append)) $append = array($append);
244
+            if(!is_array($append)) {
245
+                $append = array($append);
246
+            }
241 247
 
242 248
             foreach($append as $key => $value) {
243 249
 
@@ -261,7 +267,9 @@  discard block
 block discarded – undo
261 267
                     // results in $resultConfig['dispositions'] = ['attachment', 'inline']
262 268
                     $base[$key] = $this->array_merge_recursive_distinct($base[$key], $value);
263 269
                 } else if(is_numeric($key)) {
264
-                    if(!in_array($value, $base)) $base[] = $value;
270
+                    if(!in_array($value, $base)) {
271
+                        $base[] = $value;
272
+                    }
265 273
                 } else {
266 274
                     $base[$key] = $value;
267 275
                 }
Please login to merge, or discard this patch.
src/Client.php 2 patches
Braces   +14 added lines, -12 removed lines patch added patch discarded remove patch
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
         $value = $this->default_account_config[$key];
206 206
         if(isset($config[$key])) {
207 207
             $value = $config[$key];
208
-        }elseif(isset($default_config[$key])) {
208
+        } elseif(isset($default_config[$key])) {
209 209
             $value = $default_config[$key];
210 210
         }
211 211
         $this->$key = $value;
@@ -237,39 +237,39 @@  discard block
 block discarded – undo
237 237
             if(isset($config['masks']['message'])) {
238 238
                 if(class_exists($config['masks']['message'])) {
239 239
                     $this->default_message_mask = $config['masks']['message'];
240
-                }else{
240
+                } else{
241 241
                     throw new MaskNotFoundException("Unknown mask provided: ".$config['masks']['message']);
242 242
                 }
243
-            }else{
243
+            } else{
244 244
                 if(class_exists($default_config['message'])) {
245 245
                     $this->default_message_mask = $default_config['message'];
246
-                }else{
246
+                } else{
247 247
                     throw new MaskNotFoundException("Unknown mask provided: ".$default_config['message']);
248 248
                 }
249 249
             }
250 250
             if(isset($config['masks']['attachment'])) {
251 251
                 if(class_exists($config['masks']['attachment'])) {
252 252
                     $this->default_attachment_mask = $config['masks']['attachment'];
253
-                }else{
253
+                } else{
254 254
                     throw new MaskNotFoundException("Unknown mask provided: ".$config['masks']['attachment']);
255 255
                 }
256
-            }else{
256
+            } else{
257 257
                 if(class_exists($default_config['attachment'])) {
258 258
                     $this->default_attachment_mask = $default_config['attachment'];
259
-                }else{
259
+                } else{
260 260
                     throw new MaskNotFoundException("Unknown mask provided: ".$default_config['attachment']);
261 261
                 }
262 262
             }
263
-        }else{
263
+        } else{
264 264
             if(class_exists($default_config['message'])) {
265 265
                 $this->default_message_mask = $default_config['message'];
266
-            }else{
266
+            } else{
267 267
                 throw new MaskNotFoundException("Unknown mask provided: ".$default_config['message']);
268 268
             }
269 269
 
270 270
             if(class_exists($default_config['attachment'])) {
271 271
                 $this->default_attachment_mask = $default_config['attachment'];
272
-            }else{
272
+            } else{
273 273
                 throw new MaskNotFoundException("Unknown mask provided: ".$default_config['attachment']);
274 274
             }
275 275
         }
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
             $this->connection = new ImapProtocol($this->validate_cert, $this->encryption);
334 334
             $this->connection->setConnectionTimeout($this->timeout);
335 335
             $this->connection->setProxy($this->proxy);
336
-        }else{
336
+        } else{
337 337
             if (extension_loaded('imap') === false) {
338 338
                 throw new ConnectionFailedException("connection setup failed", 0, new ProtocolNotSupportedException($protocol." is an unsupported protocol"));
339 339
             }
@@ -516,7 +516,9 @@  discard block
 block discarded – undo
516 516
         $this->checkConnection();
517 517
         $status = $this->connection->createFolder($folder);
518 518
 
519
-        if($expunge) $this->expunge();
519
+        if($expunge) {
520
+            $this->expunge();
521
+        }
520 522
 
521 523
         $folder = $this->getFolder($folder);
522 524
         if($status && $folder) {
Please login to merge, or discard this patch.
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -203,9 +203,9 @@  discard block
 block discarded – undo
203 203
      */
204 204
     private function setAccountConfig(string $key, array $config, array $default_config): void {
205 205
         $value = $this->default_account_config[$key];
206
-        if(isset($config[$key])) {
206
+        if (isset($config[$key])) {
207 207
             $value = $config[$key];
208
-        }elseif(isset($default_config[$key])) {
208
+        }elseif (isset($default_config[$key])) {
209 209
             $value = $default_config[$key];
210 210
         }
211 211
         $this->$key = $value;
@@ -217,8 +217,8 @@  discard block
 block discarded – undo
217 217
      */
218 218
     protected function setEventsFromConfig($config): void {
219 219
         $events = ClientManager::get("events");
220
-        if(isset($config['events'])){
221
-            foreach($config['events'] as $section => $events) {
220
+        if (isset($config['events'])) {
221
+            foreach ($config['events'] as $section => $events) {
222 222
                 $events[$section] = array_merge($events[$section], $events);
223 223
             }
224 224
         }
@@ -232,45 +232,45 @@  discard block
 block discarded – undo
232 232
      * @throws MaskNotFoundException
233 233
      */
234 234
     protected function setMaskFromConfig($config): void {
235
-        $default_config  = ClientManager::get("masks");
235
+        $default_config = ClientManager::get("masks");
236 236
 
237
-        if(isset($config['masks'])){
238
-            if(isset($config['masks']['message'])) {
239
-                if(class_exists($config['masks']['message'])) {
237
+        if (isset($config['masks'])) {
238
+            if (isset($config['masks']['message'])) {
239
+                if (class_exists($config['masks']['message'])) {
240 240
                     $this->default_message_mask = $config['masks']['message'];
241
-                }else{
241
+                }else {
242 242
                     throw new MaskNotFoundException("Unknown mask provided: ".$config['masks']['message']);
243 243
                 }
244
-            }else{
245
-                if(class_exists($default_config['message'])) {
244
+            }else {
245
+                if (class_exists($default_config['message'])) {
246 246
                     $this->default_message_mask = $default_config['message'];
247
-                }else{
247
+                }else {
248 248
                     throw new MaskNotFoundException("Unknown mask provided: ".$default_config['message']);
249 249
                 }
250 250
             }
251
-            if(isset($config['masks']['attachment'])) {
252
-                if(class_exists($config['masks']['attachment'])) {
251
+            if (isset($config['masks']['attachment'])) {
252
+                if (class_exists($config['masks']['attachment'])) {
253 253
                     $this->default_attachment_mask = $config['masks']['attachment'];
254
-                }else{
254
+                }else {
255 255
                     throw new MaskNotFoundException("Unknown mask provided: ".$config['masks']['attachment']);
256 256
                 }
257
-            }else{
258
-                if(class_exists($default_config['attachment'])) {
257
+            }else {
258
+                if (class_exists($default_config['attachment'])) {
259 259
                     $this->default_attachment_mask = $default_config['attachment'];
260
-                }else{
260
+                }else {
261 261
                     throw new MaskNotFoundException("Unknown mask provided: ".$default_config['attachment']);
262 262
                 }
263 263
             }
264
-        }else{
265
-            if(class_exists($default_config['message'])) {
264
+        }else {
265
+            if (class_exists($default_config['message'])) {
266 266
                 $this->default_message_mask = $default_config['message'];
267
-            }else{
267
+            }else {
268 268
                 throw new MaskNotFoundException("Unknown mask provided: ".$default_config['message']);
269 269
             }
270 270
 
271
-            if(class_exists($default_config['attachment'])) {
271
+            if (class_exists($default_config['attachment'])) {
272 272
                 $this->default_attachment_mask = $default_config['attachment'];
273
-            }else{
273
+            }else {
274 274
                 throw new MaskNotFoundException("Unknown mask provided: ".$default_config['attachment']);
275 275
             }
276 276
         }
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
             $this->connection = new ImapProtocol($this->validate_cert, $this->encryption);
335 335
             $this->connection->setConnectionTimeout($this->timeout);
336 336
             $this->connection->setProxy($this->proxy);
337
-        }else{
337
+        }else {
338 338
             if (extension_loaded('imap') === false) {
339 339
                 throw new ConnectionFailedException("connection setup failed", 0, new ProtocolNotSupportedException($protocol." is an unsupported protocol"));
340 340
             }
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
 
356 356
         try {
357 357
             $this->connection->connect($this->host, $this->port);
358
-        } catch (ErrorException|Exceptions\RuntimeException $e) {
358
+        } catch (ErrorException | Exceptions\RuntimeException $e) {
359 359
             throw new ConnectionFailedException("connection setup failed", 0, $e);
360 360
         }
361 361
         $this->authenticate();
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
 
414 414
         // Set delimiter to false to force selection via getFolderByName (maybe useful for uncommon folder names)
415 415
         $delimiter = is_null($delimiter) ? ClientManager::get('options.delimiter', "/") : $delimiter;
416
-        if (strpos($folder_name, (string)$delimiter) !== false) {
416
+        if (strpos($folder_name, (string) $delimiter) !== false) {
417 417
             return $this->getFolderByPath($folder_name);
418 418
         }
419 419
 
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
         $pattern = $parent_folder.($hierarchical ? '%' : '*');
466 466
         $items = $this->connection->folders('', $pattern);
467 467
 
468
-        if(is_array($items)){
468
+        if (is_array($items)) {
469 469
             foreach ($items as $folder_name => $item) {
470 470
                 $folder = new Folder($this, $folder_name, $item["delimiter"], $item["flags"]);
471 471
 
@@ -517,10 +517,10 @@  discard block
 block discarded – undo
517 517
         $this->checkConnection();
518 518
         $status = $this->connection->createFolder($folder);
519 519
 
520
-        if($expunge) $this->expunge();
520
+        if ($expunge) $this->expunge();
521 521
 
522 522
         $folder = $this->getFolder($folder);
523
-        if($status && $folder) {
523
+        if ($status && $folder) {
524 524
             $event = $this->getEvent("folder", "new");
525 525
             $event::dispatch($folder);
526 526
         }
@@ -648,7 +648,7 @@  discard block
 block discarded – undo
648 648
      * @throws MaskNotFoundException
649 649
      */
650 650
     public function setDefaultMessageMask(string $mask): self {
651
-        if(class_exists($mask)) {
651
+        if (class_exists($mask)) {
652 652
             $this->default_message_mask = $mask;
653 653
 
654 654
             return $this;
@@ -674,7 +674,7 @@  discard block
 block discarded – undo
674 674
      * @throws MaskNotFoundException
675 675
      */
676 676
     public function setDefaultAttachmentMask(string $mask): self {
677
-        if(class_exists($mask)) {
677
+        if (class_exists($mask)) {
678 678
             $this->default_attachment_mask = $mask;
679 679
 
680 680
             return $this;
Please login to merge, or discard this patch.
src/Connection/Protocols/Protocol.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -246,7 +246,7 @@
 block discarded – undo
246 246
         if (is_numeric($uid)) {
247 247
             return "";
248 248
         }
249
-        return (string)$uid;
249
+        return (string) $uid;
250 250
     }
251 251
 
252 252
     public function buildUIDCommand($command, $uid) : string {
Please login to merge, or discard this patch.
src/Connection/Protocols/LegacyProtocol.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -88,16 +88,16 @@  discard block
 block discarded – undo
88 88
             throw new AuthFailedException($message);
89 89
         }
90 90
 
91
-        if(!$this->stream) {
91
+        if (!$this->stream) {
92 92
             $errors = \imap_errors();
93 93
             $message = implode("; ", (is_array($errors) ? $errors : array()));
94 94
             throw new AuthFailedException($message);
95 95
         }
96 96
 
97 97
         $errors = \imap_errors();
98
-        if(is_array($errors)) {
98
+        if (is_array($errors)) {
99 99
             $status = $this->examineFolder();
100
-            if($status['exists'] !== 0) {
100
+            if ($status['exists'] !== 0) {
101 101
                 $message = implode("; ", (is_array($errors) ? $errors : array()));
102 102
                 throw new RuntimeException($message);
103 103
             }
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
         if (!$this->cert_validation) {
129 129
             $address .= '/novalidate-cert';
130 130
         }
131
-        if (in_array($this->encryption,['tls', 'notls', 'ssl'])) {
131
+        if (in_array($this->encryption, ['tls', 'notls', 'ssl'])) {
132 132
             $address .= '/'.$this->encryption;
133 133
         } elseif ($this->encryption === "starttls") {
134 134
             $address .= '/tls';
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 
287 287
             $overview = $this->overview("1:*");
288 288
             $uids = [];
289
-            foreach($overview as $set){
289
+            foreach ($overview as $set) {
290 290
                 $uids[$set->msgno] = $set->uid;
291 291
             }
292 292
 
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
      * @return array
316 316
      */
317 317
     public function overview(string $sequence, $uid = IMAP::ST_UID): array {
318
-        return \imap_fetch_overview($this->stream, $sequence,$uid ? IMAP::ST_UID : IMAP::NIL);
318
+        return \imap_fetch_overview($this->stream, $sequence, $uid ? IMAP::ST_UID : IMAP::NIL);
319 319
     }
320 320
 
321 321
     /**
@@ -330,12 +330,12 @@  discard block
 block discarded – undo
330 330
         $result = [];
331 331
 
332 332
         $items = \imap_getmailboxes($this->stream, $this->getAddress(), $reference.$folder);
333
-        if(is_array($items)){
333
+        if (is_array($items)) {
334 334
             foreach ($items as $item) {
335 335
                 $name = $this->decodeFolderName($item->name);
336 336
                 $result[$name] = ['delimiter' => $item->delimiter, 'flags' => []];
337 337
             }
338
-        }else{
338
+        }else {
339 339
             throw new RuntimeException(\imap_last_error());
340 340
         }
341 341
 
@@ -358,9 +358,9 @@  discard block
 block discarded – undo
358 358
     public function store(array $flags, int $from, $to = null, $mode = null, bool $silent = true, $uid = IMAP::ST_UID, $item = null) {
359 359
         $flag = trim(is_array($flags) ? implode(" ", $flags) : $flags);
360 360
 
361
-        if ($mode == "+"){
361
+        if ($mode == "+") {
362 362
             $status = \imap_setflag_full($this->stream, $from, $flag, $uid ? IMAP::ST_UID : IMAP::NIL);
363
-        }else{
363
+        }else {
364 364
             $status = \imap_clearflag_full($this->stream, $from, $flag, $uid ? IMAP::ST_UID : IMAP::NIL);
365 365
         }
366 366
 
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
      */
383 383
     public function appendMessage(string $folder, string $message, $flags = null, $date = null): bool {
384 384
         if ($date != null) {
385
-            if ($date instanceof \Carbon\Carbon){
385
+            if ($date instanceof \Carbon\Carbon) {
386 386
                 $date = $date->format('d-M-Y H:i:s O');
387 387
             }
388 388
             return \imap_append($this->stream, $folder, $message, $flags, $date);
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
      * @return array|bool Tokens if operation successful, false if an error occurred
415 415
      */
416 416
     public function copyManyMessages(array $messages, string $folder, $uid = IMAP::ST_UID) {
417
-        foreach($messages as $msg) {
417
+        foreach ($messages as $msg) {
418 418
             if ($this->copyMessage($folder, $msg, null, $uid) == false) {
419 419
                 return false;
420 420
             }
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
      * @return array|bool Tokens if operation successful, false if an error occurred
447 447
      */
448 448
     public function moveManyMessages(array $messages, string $folder, $uid = IMAP::ST_UID) {
449
-        foreach($messages as $msg) {
449
+        foreach ($messages as $msg) {
450 450
             if ($this->moveMessage($folder, $msg, null, $uid) == false) {
451 451
                 return false;
452 452
             }
Please login to merge, or discard this patch.
src/Part.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
     protected function parse(): void {
160 160
         if ($this->header === null) {
161 161
             $body = $this->findHeaders();
162
-        }else{
162
+        }else {
163 163
             $body = $this->raw;
164 164
         }
165 165
 
@@ -171,11 +171,11 @@  discard block
 block discarded – undo
171 171
         $this->name = $this->header->get("name");
172 172
         $this->filename = $this->header->get("filename");
173 173
 
174
-        if(!empty($this->header->get("id"))) {
174
+        if (!empty($this->header->get("id"))) {
175 175
             $this->id = $this->header->get("id");
176
-        } else if(!empty($this->header->get("x_attachment_id"))){
176
+        }else if (!empty($this->header->get("x_attachment_id"))) {
177 177
             $this->id = $this->header->get("x_attachment_id");
178
-        } else if(!empty($this->header->get("content_id"))){
178
+        }else if (!empty($this->header->get("content_id"))) {
179 179
             $this->id = strtr($this->header->get("content_id"), [
180 180
                 '<' => '',
181 181
                 '>' => ''
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
         }
184 184
 
185 185
         $content_types = $this->header->get("content_type");
186
-        if(!empty($content_types)){
186
+        if (!empty($content_types)) {
187 187
             $this->subtype = $this->parseSubtype($content_types);
188 188
             $content_type = $content_types;
189 189
             if (is_array($content_types)) {
@@ -223,16 +223,16 @@  discard block
 block discarded – undo
223 223
      *
224 224
      * @return string
225 225
      */
226
-    private function parseSubtype($content_type){
226
+    private function parseSubtype($content_type) {
227 227
         if (is_array($content_type)) {
228
-            foreach ($content_type as $part){
229
-                if ((strpos($part, "/")) !== false){
228
+            foreach ($content_type as $part) {
229
+                if ((strpos($part, "/")) !== false) {
230 230
                     return $this->parseSubtype($part);
231 231
                 }
232 232
             }
233 233
             return null;
234 234
         }
235
-        if (($pos = strpos($content_type, "/")) !== false){
235
+        if (($pos = strpos($content_type, "/")) !== false) {
236 236
             return substr($content_type, $pos + 1);
237 237
         }
238 238
         return null;
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
      */
244 244
     private function parseDisposition(): void {
245 245
         $content_disposition = $this->header->get("content_disposition");
246
-        if($content_disposition !== null) {
246
+        if ($content_disposition !== null) {
247 247
             $this->ifdisposition = true;
248 248
             $this->disposition = (is_array($content_disposition)) ? implode(' ', $content_disposition) : $content_disposition;
249 249
         }
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
      */
255 255
     private function parseDescription(): void {
256 256
         $content_description = $this->header->get("content_description");
257
-        if($content_description !== null) {
257
+        if ($content_description !== null) {
258 258
             $this->ifdescription = true;
259 259
             $this->description = $content_description;
260 260
         }
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
      */
266 266
     private function parseEncoding(): void {
267 267
         $encoding = $this->header->get("content_transfer_encoding");
268
-        if($encoding !== null) {
268
+        if ($encoding !== null) {
269 269
             switch (strtolower($encoding)) {
270 270
                 case "quoted-printable":
271 271
                     $this->encoding = IMAP::MESSAGE_ENC_QUOTED_PRINTABLE;
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -159,7 +159,7 @@
 block discarded – undo
159 159
     protected function parse(): void {
160 160
         if ($this->header === null) {
161 161
             $body = $this->findHeaders();
162
-        }else{
162
+        } else{
163 163
             $body = $this->raw;
164 164
         }
165 165
 
Please login to merge, or discard this patch.
src/Message.php 2 patches
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
         $this->boot();
169 169
 
170 170
         $default_mask = $client->getDefaultMessageMask();
171
-        if($default_mask != null) {
171
+        if ($default_mask != null) {
172 172
             $this->mask = $default_mask;
173 173
         }
174 174
         $this->events["message"] = $client->getDefaultEvents("message");
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
         $instance->boot();
227 227
 
228 228
         $default_mask = $client->getDefaultMessageMask();
229
-        if($default_mask != null) {
229
+        if ($default_mask != null) {
230 230
             $instance->setMask($default_mask);
231 231
         }
232 232
         $instance->setEvents([
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
         }
277 277
         if (strtolower(substr($method, 0, 3)) === 'set') {
278 278
             $name = Str::snake(substr($method, 3));
279
-            if(in_array($name, array_keys($this->attributes))) {
279
+            if (in_array($name, array_keys($this->attributes))) {
280 280
                 return $this->__set($name, array_pop($arguments));
281 281
             }
282 282
         }
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
      * @return Attribute|mixed|null
315 315
      */
316 316
     public function get($name) {
317
-        if(isset($this->attributes[$name])) {
317
+        if (isset($this->attributes[$name])) {
318 318
             return $this->attributes[$name];
319 319
         }
320 320
 
@@ -399,8 +399,8 @@  discard block
 block discarded – undo
399 399
     public function parseRawFlags(array $raw_flags): void {
400 400
         $this->flags = FlagCollection::make([]);
401 401
 
402
-        foreach($raw_flags as $flag) {
403
-            if (strpos($flag, "\\") === 0){
402
+        foreach ($raw_flags as $flag) {
403
+            if (strpos($flag, "\\") === 0) {
404 404
                 $flag = substr($flag, 1);
405 405
             }
406 406
             $flag_key = strtolower($flag);
@@ -521,7 +521,7 @@  discard block
 block discarded – undo
521 521
     private function fetchPart(Part $part): void {
522 522
         if ($part->isAttachment()) {
523 523
             $this->fetchAttachment($part);
524
-        }else{
524
+        }else {
525 525
             $encoding = $this->getEncoding($part);
526 526
 
527 527
             $content = $this->decodeString($part->content, $part->encoding);
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
 
547 547
             if (isset($this->bodies[$subtype])) {
548 548
                 $this->bodies[$subtype] .= "\n".$content;
549
-            }else{
549
+            }else {
550 550
                 $this->bodies[$subtype] = $content;
551 551
             }
552 552
         }
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
         }
567 567
         if ($oAttachment->getId() !== null) {
568 568
             $this->attachments->put($oAttachment->getId(), $oAttachment);
569
-        } else {
569
+        }else {
570 570
             $this->attachments->push($oAttachment);
571 571
         }
572 572
     }
@@ -712,9 +712,9 @@  discard block
 block discarded – undo
712 712
                     return EncodingAliases::get($parameter->value, "ISO-8859-2");
713 713
                 }
714 714
             }
715
-        }elseif (property_exists($structure, 'charset')){
715
+        }elseif (property_exists($structure, 'charset')) {
716 716
             return EncodingAliases::get($structure->charset, "ISO-8859-2");
717
-        }elseif (is_string($structure) === true){
717
+        }elseif (is_string($structure) === true) {
718 718
             return mb_detect_encoding($structure);
719 719
         }
720 720
 
@@ -729,7 +729,7 @@  discard block
 block discarded – undo
729 729
      * @throws Exceptions\FolderFetchingException
730 730
      * @throws Exceptions\RuntimeException
731 731
      */
732
-    public function getFolder(){
732
+    public function getFolder() {
733 733
         return $this->client->getFolderByPath($this->folder_path);
734 734
     }
735 735
 
@@ -745,13 +745,13 @@  discard block
 block discarded – undo
745 745
      * @throws Exceptions\GetMessagesFailedException
746 746
      * @throws Exceptions\RuntimeException
747 747
      */
748
-    public function thread(Folder $sent_folder = null, MessageCollection &$thread = null, Folder $folder = null): MessageCollection {
748
+    public function thread(Folder $sent_folder = null, MessageCollection & $thread = null, Folder $folder = null): MessageCollection {
749 749
         $thread = $thread ?: MessageCollection::make([]);
750
-        $folder = $folder ?:  $this->getFolder();
750
+        $folder = $folder ?: $this->getFolder();
751 751
         $sent_folder = $sent_folder ?: $this->client->getFolderByPath(ClientManager::get("options.common_folders.sent", "INBOX/Sent"));
752 752
 
753 753
         /** @var Message $message */
754
-        foreach($thread as $message) {
754
+        foreach ($thread as $message) {
755 755
             if ($message->message_id->first() == $this->message_id->first()) {
756 756
                 return $thread;
757 757
             }
@@ -762,7 +762,7 @@  discard block
 block discarded – undo
762 762
         $this->fetchThreadByInReplyTo($thread, $this->message_id, $sent_folder, $folder, $sent_folder);
763 763
 
764 764
         if (is_array($this->in_reply_to)) {
765
-            foreach($this->in_reply_to as $in_reply_to) {
765
+            foreach ($this->in_reply_to as $in_reply_to) {
766 766
                 $this->fetchThreadByMessageId($thread, $in_reply_to, $folder, $folder, $sent_folder);
767 767
                 $this->fetchThreadByMessageId($thread, $in_reply_to, $sent_folder, $folder, $sent_folder);
768 768
             }
@@ -784,7 +784,7 @@  discard block
 block discarded – undo
784 784
      * @throws Exceptions\RuntimeException
785 785
      * @throws Exceptions\FolderFetchingException
786 786
      */
787
-    protected function fetchThreadByInReplyTo(MessageCollection &$thread, string $in_reply_to, Folder $primary_folder, Folder $secondary_folder, Folder $sent_folder): void{
787
+    protected function fetchThreadByInReplyTo(MessageCollection & $thread, string $in_reply_to, Folder $primary_folder, Folder $secondary_folder, Folder $sent_folder): void{
788 788
         $primary_folder->query()->inReplyTo($in_reply_to)
789 789
         ->setFetchBody($this->getFetchBodyOption())
790 790
         ->leaveUnread()->get()->each(function($message) use(&$thread, $secondary_folder, $sent_folder): void{
@@ -806,7 +806,7 @@  discard block
 block discarded – undo
806 806
      * @throws Exceptions\RuntimeException
807 807
      * @throws Exceptions\FolderFetchingException
808 808
      */
809
-    protected function fetchThreadByMessageId(MessageCollection &$thread, string $message_id, Folder $primary_folder, Folder $secondary_folder, Folder $sent_folder): void{
809
+    protected function fetchThreadByMessageId(MessageCollection & $thread, string $message_id, Folder $primary_folder, Folder $secondary_folder, Folder $sent_folder): void{
810 810
         $primary_folder->query()->messageId($message_id)
811 811
         ->setFetchBody($this->getFetchBodyOption())
812 812
         ->leaveUnread()->get()->each(function($message) use(&$thread, $secondary_folder, $sent_folder): void{
@@ -901,13 +901,13 @@  discard block
 block discarded – undo
901 901
      * @throws MessageHeaderFetchingException
902 902
      */
903 903
     protected function fetchNewMail(Folder $folder, int $next_uid, string $event, bool $expunge): Message {
904
-        if($expunge) $this->client->expunge();
904
+        if ($expunge) $this->client->expunge();
905 905
 
906 906
         $this->client->openFolder($folder->path);
907 907
 
908 908
         if ($this->sequence === IMAP::ST_UID) {
909 909
             $sequence_id = $next_uid;
910
-        }else{
910
+        }else {
911 911
             $sequence_id = $this->client->getConnection()->getMessageNumber($next_uid);
912 912
         }
913 913
 
@@ -937,11 +937,11 @@  discard block
 block discarded – undo
937 937
      */
938 938
     public function delete(bool $expunge = true, string $trash_path = null, bool $force_move = false) {
939 939
         $status = $this->setFlag("Deleted");
940
-        if($force_move) {
940
+        if ($force_move) {
941 941
             $trash_path ??= $this->config["common_folders"]["trash"];
942 942
             $status = $this->move($trash_path);
943 943
         }
944
-        if($expunge) $this->client->expunge();
944
+        if ($expunge) $this->client->expunge();
945 945
 
946 946
         $event = $this->getEvent("message", "deleted");
947 947
         $event::dispatch($this);
@@ -961,7 +961,7 @@  discard block
 block discarded – undo
961 961
      */
962 962
     public function restore(bool $expunge = true): bool {
963 963
         $status = $this->unsetFlag("Deleted");
964
-        if($expunge) $this->client->expunge();
964
+        if ($expunge) $this->client->expunge();
965 965
 
966 966
         $event = $this->getEvent("message", "restored");
967 967
         $event::dispatch($this);
@@ -1204,7 +1204,7 @@  discard block
 block discarded – undo
1204 1204
      * @return $this
1205 1205
      */
1206 1206
     public function setMask(string $mask): self {
1207
-        if(class_exists($mask)){
1207
+        if (class_exists($mask)) {
1208 1208
             $this->mask = $mask;
1209 1209
         }
1210 1210
 
@@ -1229,7 +1229,7 @@  discard block
 block discarded – undo
1229 1229
      */
1230 1230
     public function mask($mask = null): object {
1231 1231
         $mask ??= $this->mask;
1232
-        if(class_exists($mask)){
1232
+        if (class_exists($mask)) {
1233 1233
             return new $mask($this);
1234 1234
         }
1235 1235
 
@@ -1381,7 +1381,7 @@  discard block
 block discarded – undo
1381 1381
         if ($this->getSequence() === IMAP::ST_UID) {
1382 1382
             $this->setUid($uid);
1383 1383
             $this->setMsglist($msglist);
1384
-        }else{
1384
+        }else {
1385 1385
             $this->setMsgn($uid, $msglist);
1386 1386
         }
1387 1387
     }
Please login to merge, or discard this patch.
Braces   +16 added lines, -10 removed lines patch added patch discarded remove patch
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
             if ($this->getFlags()->get("seen") == null) {
478 478
                 $this->unsetFlag("Seen");
479 479
             }
480
-        }elseif ($this->getFlags()->get("seen") != null) {
480
+        } elseif ($this->getFlags()->get("seen") != null) {
481 481
             $this->setFlag("Seen");
482 482
         }
483 483
     }
@@ -521,7 +521,7 @@  discard block
 block discarded – undo
521 521
     private function fetchPart(Part $part): void {
522 522
         if ($part->isAttachment()) {
523 523
             $this->fetchAttachment($part);
524
-        }else{
524
+        } else{
525 525
             $encoding = $this->getEncoding($part);
526 526
 
527 527
             $content = $this->decodeString($part->content, $part->encoding);
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
 
547 547
             if (isset($this->bodies[$subtype])) {
548 548
                 $this->bodies[$subtype] .= "\n".$content;
549
-            }else{
549
+            } else{
550 550
                 $this->bodies[$subtype] = $content;
551 551
             }
552 552
         }
@@ -712,9 +712,9 @@  discard block
 block discarded – undo
712 712
                     return EncodingAliases::get($parameter->value, "ISO-8859-2");
713 713
                 }
714 714
             }
715
-        }elseif (property_exists($structure, 'charset')){
715
+        } elseif (property_exists($structure, 'charset')){
716 716
             return EncodingAliases::get($structure->charset, "ISO-8859-2");
717
-        }elseif (is_string($structure) === true){
717
+        } elseif (is_string($structure) === true){
718 718
             return mb_detect_encoding($structure);
719 719
         }
720 720
 
@@ -901,13 +901,15 @@  discard block
 block discarded – undo
901 901
      * @throws MessageHeaderFetchingException
902 902
      */
903 903
     protected function fetchNewMail(Folder $folder, int $next_uid, string $event, bool $expunge): Message {
904
-        if($expunge) $this->client->expunge();
904
+        if($expunge) {
905
+            $this->client->expunge();
906
+        }
905 907
 
906 908
         $this->client->openFolder($folder->path);
907 909
 
908 910
         if ($this->sequence === IMAP::ST_UID) {
909 911
             $sequence_id = $next_uid;
910
-        }else{
912
+        } else{
911 913
             $sequence_id = $this->client->getConnection()->getMessageNumber($next_uid);
912 914
         }
913 915
 
@@ -941,7 +943,9 @@  discard block
 block discarded – undo
941 943
             $trash_path ??= $this->config["common_folders"]["trash"];
942 944
             $status = $this->move($trash_path);
943 945
         }
944
-        if($expunge) $this->client->expunge();
946
+        if($expunge) {
947
+            $this->client->expunge();
948
+        }
945 949
 
946 950
         $event = $this->getEvent("message", "deleted");
947 951
         $event::dispatch($this);
@@ -961,7 +965,9 @@  discard block
 block discarded – undo
961 965
      */
962 966
     public function restore(bool $expunge = true): bool {
963 967
         $status = $this->unsetFlag("Deleted");
964
-        if($expunge) $this->client->expunge();
968
+        if($expunge) {
969
+            $this->client->expunge();
970
+        }
965 971
 
966 972
         $event = $this->getEvent("message", "restored");
967 973
         $event::dispatch($this);
@@ -1381,7 +1387,7 @@  discard block
 block discarded – undo
1381 1387
         if ($this->getSequence() === IMAP::ST_UID) {
1382 1388
             $this->setUid($uid);
1383 1389
             $this->setMsglist($msglist);
1384
-        }else{
1390
+        } else{
1385 1391
             $this->setMsgn($uid, $msglist);
1386 1392
         }
1387 1393
     }
Please login to merge, or discard this patch.