Passed
Push — master ( 1c2115...1aebda )
by Malte
02:17
created
src/Connection/Protocols/ImapProtocol.php 1 patch
Braces   +13 added lines, -6 removed lines patch added patch discarded remove patch
@@ -233,7 +233,9 @@  discard block
 block discarded – undo
233 233
         } else {
234 234
             $tokens = $line;
235 235
         }
236
-        if ($this->debug) echo "<< ".$line."\n";
236
+        if ($this->debug) {
237
+            echo "<< ".$line."\n";
238
+        }
237 239
 
238 240
         // if tag is wanted tag we might be at the end of a multiline response
239 241
         return $tag == $wantedTag;
@@ -298,7 +300,9 @@  discard block
 block discarded – undo
298 300
                 $line .= ' ' . $token;
299 301
             }
300 302
         }
301
-        if ($this->debug) echo ">> ".$line."\n";
303
+        if ($this->debug) {
304
+            echo ">> ".$line."\n";
305
+        }
302 306
 
303 307
         if (fwrite($this->stream, $line . "\r\n") === false) {
304 308
             throw new RuntimeException('failed to write - connection closed?');
@@ -448,7 +452,9 @@  discard block
 block discarded – undo
448 452
     public function getCapabilities() {
449 453
         $response = $this->requestAndResponse('CAPABILITY');
450 454
 
451
-        if (!$response) return [];
455
+        if (!$response) {
456
+            return [];
457
+        }
452 458
 
453 459
         $capabilities = [];
454 460
         foreach ($response as $line) {
@@ -605,13 +611,14 @@  discard block
 block discarded – undo
605 611
             // if we want only one message we can ignore everything else and just return
606 612
             if ($to === null && !is_array($from) && ($uid ? $tokens[2][$uidKey] == $from : $tokens[0] == $from)) {
607 613
                 // we still need to read all lines
608
-                while (!$this->readLine($tokens, $tag))
609
-
614
+                while (!$this->readLine($tokens, $tag)) {
615
+                
610 616
                     return $data;
617
+                }
611 618
             }
612 619
             if ($uid) {
613 620
                 $result[$tokens[2][$uidKey]] = $data;
614
-            }else{
621
+            } else{
615 622
                 $result[$tokens[0]] = $data;
616 623
             }
617 624
         }
Please login to merge, or discard this patch.
src/Client.php 1 patch
Braces   +15 added lines, -13 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;
@@ -239,39 +239,39 @@  discard block
 block discarded – undo
239 239
             if(isset($config['masks']['message'])) {
240 240
                 if(class_exists($config['masks']['message'])) {
241 241
                     $this->default_message_mask = $config['masks']['message'];
242
-                }else{
242
+                } else{
243 243
                     throw new MaskNotFoundException("Unknown mask provided: ".$config['masks']['message']);
244 244
                 }
245
-            }else{
245
+            } else{
246 246
                 if(class_exists($default_config['message'])) {
247 247
                     $this->default_message_mask = $default_config['message'];
248
-                }else{
248
+                } else{
249 249
                     throw new MaskNotFoundException("Unknown mask provided: ".$default_config['message']);
250 250
                 }
251 251
             }
252 252
             if(isset($config['masks']['attachment'])) {
253 253
                 if(class_exists($config['masks']['attachment'])) {
254 254
                     $this->default_message_mask = $config['masks']['attachment'];
255
-                }else{
255
+                } else{
256 256
                     throw new MaskNotFoundException("Unknown mask provided: ".$config['masks']['attachment']);
257 257
                 }
258
-            }else{
258
+            } else{
259 259
                 if(class_exists($default_config['attachment'])) {
260 260
                     $this->default_message_mask = $default_config['attachment'];
261
-                }else{
261
+                } else{
262 262
                     throw new MaskNotFoundException("Unknown mask provided: ".$default_config['attachment']);
263 263
                 }
264 264
             }
265
-        }else{
265
+        } else{
266 266
             if(class_exists($default_config['message'])) {
267 267
                 $this->default_message_mask = $default_config['message'];
268
-            }else{
268
+            } else{
269 269
                 throw new MaskNotFoundException("Unknown mask provided: ".$default_config['message']);
270 270
             }
271 271
 
272 272
             if(class_exists($default_config['attachment'])) {
273 273
                 $this->default_message_mask = $default_config['attachment'];
274
-            }else{
274
+            } else{
275 275
                 throw new MaskNotFoundException("Unknown mask provided: ".$default_config['attachment']);
276 276
             }
277 277
         }
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
             $this->connection = new ImapProtocol($this->validate_cert, $this->encryption);
336 336
             $this->connection->setConnectionTimeout($this->timeout);
337 337
             $this->connection->setProxy($this->proxy);
338
-        }else{
338
+        } else{
339 339
             if (extension_loaded('imap') === false) {
340 340
                 throw new ConnectionFailedException("connection setup failed", 0, new ProtocolNotSupportedException($protocol." is an unsupported protocol"));
341 341
             }
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
             }
474 474
 
475 475
             return $folders;
476
-        }else{
476
+        } else{
477 477
             throw new FolderFetchingException("failed to fetch any folders");
478 478
         }
479 479
     }
@@ -511,7 +511,9 @@  discard block
 block discarded – undo
511 511
         $this->checkConnection();
512 512
         $status = $this->connection->createFolder($folder);
513 513
 
514
-        if($expunge) $this->expunge();
514
+        if($expunge) {
515
+            $this->expunge();
516
+        }
515 517
 
516 518
         $folder = $this->getFolder($folder);
517 519
         if($status && $folder) {
Please login to merge, or discard this patch.
src/Header.php 1 patch
Braces   +20 added lines, -16 removed lines patch added patch discarded remove patch
@@ -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]) == false) {
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
-        }elseif($this->attributize == false){
144
+        } elseif($this->attributize == false){
145 145
             $this->attributes[$name] = $value;
146
-        }else{
146
+        } else{
147 147
             $this->attributes[$name] = new Attribute($name, $value);
148 148
         }
149 149
 
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
                 if ($prev_header !== null) {
231 231
                     $headers[$prev_header][] = $line;
232 232
                 }
233
-            }elseif (substr($line, 0, 1) === " ") {
233
+            } elseif (substr($line, 0, 1) === " ") {
234 234
                 $line = substr($line, 1);
235 235
                 $line = trim(rtrim($line));
236 236
                 if ($prev_header !== null) {
@@ -239,11 +239,11 @@  discard block
 block discarded – undo
239 239
                     }
240 240
                     if (is_array($headers[$prev_header])) {
241 241
                         $headers[$prev_header][] = $line;
242
-                    }else{
242
+                    } else{
243 243
                         $headers[$prev_header] .= $line;
244 244
                     }
245 245
                 }
246
-            }else{
246
+            } else{
247 247
                 if (($pos = strpos($line, ":")) > 0) {
248 248
                     $key = trim(rtrim(strtolower(substr($line, 0, $pos))));
249 249
                     $key = str_replace("-", "_", $key);
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
                     $value = trim(rtrim(substr($line, $pos + 1)));
252 252
                     if (isset($headers[$key])) {
253 253
                         $headers[$key][]  = $value;
254
-                    }else{
254
+                    } else{
255 255
                         $headers[$key] = [$value];
256 256
                     }
257 257
                     $prev_header = $key;
@@ -260,7 +260,9 @@  discard block
 block discarded – undo
260 260
         }
261 261
 
262 262
         foreach($headers as $key => $values) {
263
-            if (isset($imap_headers[$key])) continue;
263
+            if (isset($imap_headers[$key])) {
264
+                continue;
265
+            }
264 266
             $value = null;
265 267
             switch($key){
266 268
                 case 'from':
@@ -397,9 +399,9 @@  discard block
 block discarded – undo
397 399
                     return EncodingAliases::get($parameter->value, $this->fallback_encoding);
398 400
                 }
399 401
             }
400
-        }elseif (property_exists($structure, 'charset')) {
402
+        } elseif (property_exists($structure, 'charset')) {
401 403
             return EncodingAliases::get($structure->charset, $this->fallback_encoding);
402
-        }elseif (is_string($structure) === true){
404
+        } elseif (is_string($structure) === true){
403 405
             return mb_detect_encoding($structure);
404 406
         }
405 407
 
@@ -446,9 +448,9 @@  discard block
 block discarded – undo
446 448
                         }
447 449
                     }
448 450
                 }
449
-            }elseif($decoder === 'iconv' && $is_utf8_base) {
451
+            } elseif($decoder === 'iconv' && $is_utf8_base) {
450 452
                 $value = iconv_mime_decode($value);
451
-            }elseif($is_utf8_base){
453
+            } elseif($is_utf8_base){
452 454
                 $value = mb_decode_mimeheader($value);
453 455
             }
454 456
 
@@ -481,7 +483,9 @@  discard block
 block discarded – undo
481 483
      * Try to extract the priority from a given raw header string
482 484
      */
483 485
     private function findPriority() {
484
-        if(($priority = $this->get("x_priority")) === null) return;
486
+        if(($priority = $this->get("x_priority")) === null) {
487
+            return;
488
+        }
485 489
         switch((int)"$priority"){
486 490
             case IMAP::MESSAGE_PRIORITY_HIGHEST;
487 491
                 $priority = IMAP::MESSAGE_PRIORITY_HIGHEST;
@@ -604,7 +608,7 @@  discard block
 block discarded – undo
604 608
         foreach ($this->attributes as $key => $value) {
605 609
             if (is_array($value)) {
606 610
                 $value = implode(", ", $value);
607
-            }else{
611
+            } else{
608 612
                 $value = (string)$value;
609 613
             }
610 614
             // Only parse strings and don't parse any attributes like the user-agent
Please login to merge, or discard this patch.
src/Message.php 1 patch
Braces   +17 added lines, -11 removed lines patch added patch discarded remove patch
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
         if(strtolower(substr($method, 0, 3)) === 'get') {
306 306
             $name = Str::snake(substr($method, 3));
307 307
             return $this->get($name);
308
-        }elseif (strtolower(substr($method, 0, 3)) === 'set') {
308
+        } elseif (strtolower(substr($method, 0, 3)) === 'set') {
309 309
             $name = Str::snake(substr($method, 3));
310 310
 
311 311
             if(in_array($name, array_keys($this->attributes))) {
@@ -511,7 +511,7 @@  discard block
 block discarded – undo
511 511
             if ($this->getFlags()->get("seen") == null) {
512 512
                 $this->unsetFlag("Seen");
513 513
             }
514
-        }elseif ($this->getFlags()->get("seen") != null) {
514
+        } elseif ($this->getFlags()->get("seen") != null) {
515 515
             $this->setFlag("Seen");
516 516
         }
517 517
     }
@@ -555,7 +555,7 @@  discard block
 block discarded – undo
555 555
     private function fetchPart(Part $part) {
556 556
         if ($part->isAttachment()) {
557 557
             $this->fetchAttachment($part);
558
-        }else{
558
+        } else{
559 559
             $encoding = $this->getEncoding($part);
560 560
 
561 561
             $content = $this->decodeString($part->content, $part->encoding);
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
 
581 581
             if (isset($this->bodies[$subtype])) {
582 582
                 $this->bodies[$subtype] .= "\n".$content;
583
-            }else{
583
+            } else{
584 584
                 $this->bodies[$subtype] = $content;
585 585
             }
586 586
         }
@@ -751,9 +751,9 @@  discard block
 block discarded – undo
751 751
                     return EncodingAliases::get($parameter->value);
752 752
                 }
753 753
             }
754
-        }elseif (property_exists($structure, 'charset')){
754
+        } elseif (property_exists($structure, 'charset')){
755 755
             return EncodingAliases::get($structure->charset);
756
-        }elseif (is_string($structure) === true){
756
+        } elseif (is_string($structure) === true){
757 757
             return mb_detect_encoding($structure);
758 758
         }
759 759
 
@@ -937,13 +937,15 @@  discard block
 block discarded – undo
937 937
      * @throws MessageHeaderFetchingException
938 938
      */
939 939
     protected function fetchNewMail($folder, $next_uid, $event, $expunge){
940
-        if($expunge) $this->client->expunge();
940
+        if($expunge) {
941
+            $this->client->expunge();
942
+        }
941 943
 
942 944
         $this->client->openFolder($folder->path);
943 945
 
944 946
         if ($this->sequence === IMAP::ST_UID) {
945 947
             $sequence_id = $next_uid;
946
-        }else{
948
+        } else{
947 949
             $sequence_id = $this->client->getConnection()->getMessageNumber($next_uid);
948 950
         }
949 951
 
@@ -966,7 +968,9 @@  discard block
 block discarded – undo
966 968
      */
967 969
     public function delete($expunge = true) {
968 970
         $status = $this->setFlag("Deleted");
969
-        if($expunge) $this->client->expunge();
971
+        if($expunge) {
972
+            $this->client->expunge();
973
+        }
970 974
 
971 975
         $event = $this->getEvent("message", "deleted");
972 976
         $event::dispatch($this);
@@ -986,7 +990,9 @@  discard block
 block discarded – undo
986 990
      */
987 991
     public function restore($expunge = true) {
988 992
         $status = $this->unsetFlag("Deleted");
989
-        if($expunge) $this->client->expunge();
993
+        if($expunge) {
994
+            $this->client->expunge();
995
+        }
990 996
 
991 997
         $event = $this->getEvent("message", "restored");
992 998
         $event::dispatch($this);
@@ -1405,7 +1411,7 @@  discard block
 block discarded – undo
1405 1411
         if ($this->getSequence() === IMAP::ST_UID) {
1406 1412
             $this->setUid($uid);
1407 1413
             $this->setMsglist($msglist);
1408
-        }else{
1414
+        } else{
1409 1415
             $this->setMsgn($uid, $msglist);
1410 1416
         }
1411 1417
     }
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
@@ -90,7 +90,7 @@
 block discarded – undo
90 90
         $content_type = (is_array($content_type)) ? implode(' ', $content_type) : $content_type;
91 91
         if(stripos($content_type, 'multipart') === 0) {
92 92
             $this->type = IMAP::MESSAGE_TYPE_MULTIPART;
93
-        }else{
93
+        } else{
94 94
             $this->type = IMAP::MESSAGE_TYPE_TEXT;
95 95
         }
96 96
     }
Please login to merge, or discard this patch.
src/Query/Query.php 1 patch
Braces   +10 added lines, -4 removed lines patch added patch discarded remove patch
@@ -84,7 +84,9 @@  discard block
 block discarded – undo
84 84
         $this->setClient($client);
85 85
 
86 86
         $this->sequence = ClientManager::get('options.sequence', IMAP::ST_MSGN);
87
-        if (ClientManager::get('options.fetch') === IMAP::FT_PEEK) $this->leaveUnread();
87
+        if (ClientManager::get('options.fetch') === IMAP::FT_PEEK) {
88
+            $this->leaveUnread();
89
+        }
88 90
 
89 91
         if (ClientManager::get('options.fetch_order') === 'desc') {
90 92
             $this->fetch_order = 'desc';
@@ -129,7 +131,9 @@  discard block
 block discarded – undo
129 131
      * @throws MessageSearchValidationException
130 132
      */
131 133
     protected function parse_date($date) {
132
-        if ($date instanceof Carbon) return $date;
134
+        if ($date instanceof Carbon) {
135
+            return $date;
136
+        }
133 137
 
134 138
         try {
135 139
             $date = Carbon::parse($date);
@@ -363,7 +367,7 @@  discard block
 block discarded – undo
363 367
             } else {
364 368
                 if($statement[1] === null){
365 369
                     $query .= $statement[0];
366
-                }else{
370
+                } else{
367 371
                     $query .= $statement[0].' "'.$statement[1].'"';
368 372
                 }
369 373
             }
@@ -393,7 +397,9 @@  discard block
 block discarded – undo
393 397
      * @return $this
394 398
      */
395 399
     public function limit($limit, $page = 1) {
396
-        if ($page >= 1) $this->page = $page;
400
+        if ($page >= 1) {
401
+            $this->page = $page;
402
+        }
397 403
         $this->limit = $limit;
398 404
 
399 405
         return $this;
Please login to merge, or discard this patch.
src/Query/WhereQuery.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -152,7 +152,9 @@  discard block
 block discarded – undo
152 152
      */
153 153
     public function orWhere(Closure $closure = null) {
154 154
         $this->query->push(['OR']);
155
-        if ($closure !== null) $closure($this);
155
+        if ($closure !== null) {
156
+            $closure($this);
157
+        }
156 158
 
157 159
         return $this;
158 160
     }
@@ -164,7 +166,9 @@  discard block
 block discarded – undo
164 166
      */
165 167
     public function andWhere(Closure $closure = null) {
166 168
         $this->query->push(['AND']);
167
-        if ($closure !== null) $closure($this);
169
+        if ($closure !== null) {
170
+            $closure($this);
171
+        }
168 172
 
169 173
         return $this;
170 174
     }
Please login to merge, or discard this patch.
src/Attachment.php 1 patch
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
             }
129 129
 
130 130
             return null;
131
-        }elseif (strtolower(substr($method, 0, 3)) === 'set') {
131
+        } elseif (strtolower(substr($method, 0, 3)) === 'set') {
132 132
             $name = Str::snake(substr($method, 3));
133 133
 
134 134
             $this->attributes[$name] = array_pop($arguments);
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
             $this->setName($filename);
223 223
         } elseif (($name = $this->part->name) !== null) {
224 224
             $this->setName($name);
225
-        }else {
225
+        } else {
226 226
             $this->setName("undefined");
227 227
         }
228 228
 
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
         if ($name !== null) {
258 258
             if($decoder === 'utf-8' && extension_loaded('imap')) {
259 259
                 $this->name = \imap_utf8($name);
260
-            }else{
260
+            } else{
261 261
                 $this->name = mb_decode_mimeheader($name);
262 262
             }
263 263
         }
Please login to merge, or discard this patch.