Passed
Push — master ( 438e1d...cc3e72 )
by Malte
02:29
created
src/Header.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -285,7 +285,9 @@  discard block
 block discarded – undo
285 285
         }
286 286
 
287 287
         foreach ($headers as $key => $values) {
288
-            if (isset($imap_headers[$key])) continue;
288
+            if (isset($imap_headers[$key])) {
289
+                continue;
290
+            }
289 291
             $value = null;
290 292
             switch ($key) {
291 293
                 case 'from':
@@ -506,7 +508,9 @@  discard block
 block discarded – undo
506 508
      * Try to extract the priority from a given raw header string
507 509
      */
508 510
     private function findPriority() {
509
-        if (($priority = $this->get("x_priority")) === null) return;
511
+        if (($priority = $this->get("x_priority")) === null) {
512
+            return;
513
+        }
510 514
         switch ((int)"$priority") {
511 515
             case IMAP::MESSAGE_PRIORITY_HIGHEST;
512 516
                 $priority = IMAP::MESSAGE_PRIORITY_HIGHEST;
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
             }
@@ -230,15 +230,21 @@  discard block
 block discarded – undo
230 230
 
231 231
         // From https://stackoverflow.com/a/173479
232 232
         $isAssoc = function(array $arr) {
233
-            if (array() === $arr) return false;
233
+            if (array() === $arr) {
234
+                return false;
235
+            }
234 236
             return array_keys($arr) !== range(0, count($arr) - 1);
235 237
         };
236 238
 
237
-        if(!is_array($base)) $base = empty($base) ? array() : array($base);
239
+        if(!is_array($base)) {
240
+            $base = empty($base) ? array() : array($base);
241
+        }
238 242
 
239 243
         foreach($arrays as $append) {
240 244
 
241
-            if(!is_array($append)) $append = array($append);
245
+            if(!is_array($append)) {
246
+                $append = array($append);
247
+            }
242 248
 
243 249
             foreach($append as $key => $value) {
244 250
 
@@ -262,7 +268,9 @@  discard block
 block discarded – undo
262 268
                     // results in $resultConfig['dispositions'] = ['attachment', 'inline']
263 269
                     $base[$key] = $this->array_merge_recursive_distinct($base[$key], $value);
264 270
                 } else if(is_numeric($key)) {
265
-                    if(!in_array($value, $base)) $base[] = $value;
271
+                    if(!in_array($value, $base)) {
272
+                        $base[] = $value;
273
+                    }
266 274
                 } else {
267 275
                     $base[$key] = $value;
268 276
                 }
Please login to merge, or discard this patch.
src/Attribute.php 1 patch
Braces   +5 added lines, -3 removed lines patch added patch discarded remove patch
@@ -78,7 +78,9 @@  discard block
 block discarded – undo
78 78
      */
79 79
     public function toDate(): Carbon {
80 80
         $date = $this->first();
81
-        if ($date instanceof Carbon) return $date;
81
+        if ($date instanceof Carbon) {
82
+            return $date;
83
+        }
82 84
 
83 85
         return Carbon::parse($date);
84 86
     }
@@ -141,7 +143,7 @@  discard block
 block discarded – undo
141 143
     public function add($value, bool $strict = false): Attribute {
142 144
         if (is_array($value)) {
143 145
             return $this->merge($value, $strict);
144
-        }elseif ($value !== null) {
146
+        } elseif ($value !== null) {
145 147
             $this->attach($value, $strict);
146 148
         }
147 149
 
@@ -188,7 +190,7 @@  discard block
 block discarded – undo
188 190
             if ($this->contains($value) === false) {
189 191
                 $this->values[] = $value;
190 192
             }
191
-        }else{
193
+        } else{
192 194
             $this->values[] = $value;
193 195
         }
194 196
     }
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): WhereQuery {
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): WhereQuery {
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/Query/Query.php 1 patch
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -91,7 +91,9 @@  discard block
 block discarded – undo
91 91
         $this->setClient($client);
92 92
 
93 93
         $this->sequence = ClientManager::get('options.sequence', IMAP::ST_MSGN);
94
-        if (ClientManager::get('options.fetch') === IMAP::FT_PEEK) $this->leaveUnread();
94
+        if (ClientManager::get('options.fetch') === IMAP::FT_PEEK) {
95
+            $this->leaveUnread();
96
+        }
95 97
 
96 98
         if (ClientManager::get('options.fetch_order') === 'desc') {
97 99
             $this->fetch_order = 'desc';
@@ -137,7 +139,9 @@  discard block
 block discarded – undo
137 139
      * @throws MessageSearchValidationException
138 140
      */
139 141
     protected function parse_date($date): Carbon {
140
-        if ($date instanceof Carbon) return $date;
142
+        if ($date instanceof Carbon) {
143
+            return $date;
144
+        }
141 145
 
142 146
         try {
143 147
             $date = Carbon::parse($date);
@@ -644,7 +648,9 @@  discard block
 block discarded – undo
644 648
      * @return $this
645 649
      */
646 650
     public function limit(int $limit, int $page = 1): Query {
647
-        if ($page >= 1) $this->page = $page;
651
+        if ($page >= 1) {
652
+            $this->page = $page;
653
+        }
648 654
         $this->limit = $limit;
649 655
 
650 656
         return $this;
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
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
         if(strtolower(substr($method, 0, 3)) === 'get') {
300 300
             $name = Str::snake(substr($method, 3));
301 301
             return $this->get($name);
302
-        }elseif (strtolower(substr($method, 0, 3)) === 'set') {
302
+        } elseif (strtolower(substr($method, 0, 3)) === 'set') {
303 303
             $name = Str::snake(substr($method, 3));
304 304
 
305 305
             if(in_array($name, array_keys($this->attributes))) {
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
             if ($this->getFlags()->get("seen") == null) {
506 506
                 $this->unsetFlag("Seen");
507 507
             }
508
-        }elseif ($this->getFlags()->get("seen") != null) {
508
+        } elseif ($this->getFlags()->get("seen") != null) {
509 509
             $this->setFlag("Seen");
510 510
         }
511 511
     }
@@ -549,7 +549,7 @@  discard block
 block discarded – undo
549 549
     private function fetchPart(Part $part) {
550 550
         if ($part->isAttachment()) {
551 551
             $this->fetchAttachment($part);
552
-        }else{
552
+        } else{
553 553
             $encoding = $this->getEncoding($part);
554 554
 
555 555
             $content = $this->decodeString($part->content, $part->encoding);
@@ -574,7 +574,7 @@  discard block
 block discarded – undo
574 574
 
575 575
             if (isset($this->bodies[$subtype])) {
576 576
                 $this->bodies[$subtype] .= "\n".$content;
577
-            }else{
577
+            } else{
578 578
                 $this->bodies[$subtype] = $content;
579 579
             }
580 580
         }
@@ -745,9 +745,9 @@  discard block
 block discarded – undo
745 745
                     return EncodingAliases::get($parameter->value, "ISO-8859-2");
746 746
                 }
747 747
             }
748
-        }elseif (property_exists($structure, 'charset')){
748
+        } elseif (property_exists($structure, 'charset')){
749 749
             return EncodingAliases::get($structure->charset, "ISO-8859-2");
750
-        }elseif (is_string($structure) === true){
750
+        } elseif (is_string($structure) === true){
751 751
             return mb_detect_encoding($structure);
752 752
         }
753 753
 
@@ -936,13 +936,15 @@  discard block
 block discarded – undo
936 936
      * @throws MessageHeaderFetchingException
937 937
      */
938 938
     protected function fetchNewMail(Folder $folder, int $next_uid, string $event, bool $expunge): Message {
939
-        if($expunge) $this->client->expunge();
939
+        if($expunge) {
940
+            $this->client->expunge();
941
+        }
940 942
 
941 943
         $this->client->openFolder($folder->path);
942 944
 
943 945
         if ($this->sequence === IMAP::ST_UID) {
944 946
             $sequence_id = $next_uid;
945
-        }else{
947
+        } else{
946 948
             $sequence_id = $this->client->getConnection()->getMessageNumber($next_uid);
947 949
         }
948 950
 
@@ -976,7 +978,9 @@  discard block
 block discarded – undo
976 978
             $trash_path = $trash_path === null ? $this->config["common_folders"]["trash"]: $trash_path;
977 979
             $status = $this->move($trash_path);
978 980
         }
979
-        if($expunge) $this->client->expunge();
981
+        if($expunge) {
982
+            $this->client->expunge();
983
+        }
980 984
 
981 985
         $event = $this->getEvent("message", "deleted");
982 986
         $event::dispatch($this);
@@ -996,7 +1000,9 @@  discard block
 block discarded – undo
996 1000
      */
997 1001
     public function restore(bool $expunge = true): bool {
998 1002
         $status = $this->unsetFlag("Deleted");
999
-        if($expunge) $this->client->expunge();
1003
+        if($expunge) {
1004
+            $this->client->expunge();
1005
+        }
1000 1006
 
1001 1007
         $event = $this->getEvent("message", "restored");
1002 1008
         $event::dispatch($this);
@@ -1424,7 +1430,7 @@  discard block
 block discarded – undo
1424 1430
         if ($this->getSequence() === IMAP::ST_UID) {
1425 1431
             $this->setUid($uid);
1426 1432
             $this->setMsglist($msglist);
1427
-        }else{
1433
+        } else{
1428 1434
             $this->setMsgn($uid, $msglist);
1429 1435
         }
1430 1436
     }
Please login to merge, or discard this patch.
src/Folder.php 1 patch
Braces   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -240,7 +240,9 @@  discard block
 block discarded – undo
240 240
     public function move(string $new_name, bool $expunge = true): bool {
241 241
         $this->client->checkConnection();
242 242
         $status = $this->client->getConnection()->renameFolder($this->full_name, $new_name);
243
-        if($expunge) $this->client->expunge();
243
+        if($expunge) {
244
+            $this->client->expunge();
245
+        }
244 246
 
245 247
         $folder = $this->client->getFolder($new_name);
246 248
         $event = $this->getEvent("folder", "moved");
@@ -316,7 +318,9 @@  discard block
 block discarded – undo
316 318
      */
317 319
     public function delete(bool $expunge = true): bool {
318 320
         $status = $this->client->getConnection()->deleteFolder($this->path);
319
-        if($expunge) $this->client->expunge();
321
+        if($expunge) {
322
+            $this->client->expunge();
323
+        }
320 324
 
321 325
         $event = $this->getEvent("folder", "deleted");
322 326
         $event::dispatch($this);
@@ -395,7 +399,7 @@  discard block
 block discarded – undo
395 399
                     $connection->done();
396 400
                     $connection->idle();
397 401
                 }
398
-            }catch (Exceptions\RuntimeException $e) {
402
+            } catch (Exceptions\RuntimeException $e) {
399 403
                 if(strpos($e->getMessage(), "empty response") >= 0 && $connection->connected()) {
400 404
                     $connection->done();
401 405
                     $connection->idle();
Please login to merge, or discard this patch.
src/Connection/Protocols/ImapProtocol.php 1 patch
Braces   +16 added lines, -7 removed lines patch added patch discarded remove patch
@@ -111,7 +111,9 @@  discard block
 block discarded – undo
111 111
         if ($line === "") {
112 112
             throw new RuntimeException('empty response');
113 113
         }
114
-        if ($this->debug) echo "<< ".$line."\n";
114
+        if ($this->debug) {
115
+            echo "<< ".$line."\n";
116
+        }
115 117
         return $line . "\n";
116 118
     }
117 119
 
@@ -325,7 +327,9 @@  discard block
 block discarded – undo
325 327
      * @throws RuntimeException
326 328
      */
327 329
     public function write(string $data) {
328
-        if ($this->debug) echo ">> ".$data ."\n";
330
+        if ($this->debug) {
331
+            echo ">> ".$data ."\n";
332
+        }
329 333
 
330 334
         if (fwrite($this->stream, $data . "\r\n") === false) {
331 335
             throw new RuntimeException('failed to write - connection closed?');
@@ -477,7 +481,9 @@  discard block
 block discarded – undo
477 481
     public function getCapabilities(): array {
478 482
         $response = $this->requestAndResponse('CAPABILITY');
479 483
 
480
-        if (!$response) return [];
484
+        if (!$response) {
485
+            return [];
486
+        }
481 487
 
482 488
         $capabilities = [];
483 489
         foreach ($response as $line) {
@@ -637,13 +643,14 @@  discard block
 block discarded – undo
637 643
             // if we want only one message we can ignore everything else and just return
638 644
             if ($to === null && !is_array($from) && ($uid ? $tokens[2][$uidKey] == $from : $tokens[0] == $from)) {
639 645
                 // we still need to read all lines
640
-                while (!$this->readLine($tokens, $tag))
641
-
646
+                while (!$this->readLine($tokens, $tag)) {
647
+                
642 648
                     return $data;
649
+                }
643 650
             }
644 651
             if ($uid) {
645 652
                 $result[$tokens[2][$uidKey]] = $data;
646
-            }else{
653
+            } else{
647 654
                 $result[$tokens[0]] = $data;
648 655
             }
649 656
         }
@@ -1073,7 +1080,9 @@  discard block
 block discarded – undo
1073 1080
     public function search(array $params, $uid = IMAP::ST_UID): array {
1074 1081
         $command = $this->buildUIDCommand("SEARCH", $uid);
1075 1082
         $response = $this->requestAndResponse($command, $params);
1076
-        if (!$response) return [];
1083
+        if (!$response) {
1084
+            return [];
1085
+        }
1077 1086
 
1078 1087
         foreach ($response as $ids) {
1079 1088
             if ($ids[0] == 'SEARCH') {
Please login to merge, or discard this patch.