Passed
Pull Request — master (#242)
by
unknown
02:35
created
src/Header.php 1 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 1 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 1 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 1 patch
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.
src/Part.php 1 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 1 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.
src/Attribute.php 1 patch
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -77,7 +77,9 @@  discard block
 block discarded – undo
77 77
      */
78 78
     public function toDate(): Carbon {
79 79
         $date = $this->first();
80
-        if ($date instanceof Carbon) return $date;
80
+        if ($date instanceof Carbon) {
81
+            return $date;
82
+        }
81 83
 
82 84
         return Carbon::parse($date);
83 85
     }
@@ -180,7 +182,7 @@  discard block
 block discarded – undo
180 182
             if ($this->contains($value) === false) {
181 183
                 $this->values[] = $value;
182 184
             }
183
-        }else{
185
+        } else{
184 186
             $this->values[] = $value;
185 187
         }
186 188
     }
Please login to merge, or discard this patch.
src/Query/WhereQuery.php 1 patch
Braces   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
             foreach ($criteria as $key => $value) {
138 138
                 if (is_numeric($key)) {
139 139
                     $this->where($value);
140
-                }else{
140
+                } else{
141 141
                     $this->where($key, $value);
142 142
                 }
143 143
             }
@@ -173,7 +173,9 @@  discard block
 block discarded – undo
173 173
      */
174 174
     public function orWhere(Closure $closure = null): self {
175 175
         $this->query->push(['OR']);
176
-        if ($closure !== null) $closure($this);
176
+        if ($closure !== null) {
177
+            $closure($this);
178
+        }
177 179
 
178 180
         return $this;
179 181
     }
@@ -185,7 +187,9 @@  discard block
 block discarded – undo
185 187
      */
186 188
     public function andWhere(Closure $closure = null): self {
187 189
         $this->query->push(['AND']);
188
-        if ($closure !== null) $closure($this);
190
+        if ($closure !== null) {
191
+            $closure($this);
192
+        }
189 193
 
190 194
         return $this;
191 195
     }
Please login to merge, or discard this patch.
src/Support/Masks/MessageMask.php 1 patch
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -50,7 +50,9 @@  discard block
 block discarded – undo
50 50
      */
51 51
     public function getCustomHTMLBody($callback = false): ?string {
52 52
         $body = $this->getHtmlBody();
53
-        if($body === null) return null;
53
+        if($body === null) {
54
+            return null;
55
+        }
54 56
 
55 57
         if ($callback !== false) {
56 58
             $aAttachment = $this->parent->getAttachments();
@@ -58,7 +60,7 @@  discard block
 block discarded – undo
58 60
                 /** @var Attachment $oAttachment */
59 61
                 if(is_callable($callback)) {
60 62
                     $body = $callback($body, $oAttachment);
61
-                }elseif(is_string($callback)) {
63
+                } elseif(is_string($callback)) {
62 64
                     call_user_func($callback, [$body, $oAttachment]);
63 65
                 }
64 66
             });
Please login to merge, or discard this patch.