Passed
Push — master ( fbc5b7...d88edd )
by Malte
03:02
created
src/Message.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
         $this->boot();
193 193
 
194 194
         $default_mask = $client->getDefaultMessageMask();
195
-        if($default_mask != null) {
195
+        if ($default_mask != null) {
196 196
             $this->mask = $default_mask;
197 197
         }
198 198
         $this->events["message"] = $client->getDefaultEvents("message");
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
         $instance->boot();
254 254
 
255 255
         $default_mask = $client->getDefaultMessageMask();
256
-        if($default_mask != null) {
256
+        if ($default_mask != null) {
257 257
             $instance->setMask($default_mask);
258 258
         }
259 259
         $instance->setEvents([
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
     /**
279 279
      * Boot a new instance
280 280
      */
281
-    public function boot(){
281
+    public function boot() {
282 282
         $this->attributes = [];
283 283
 
284 284
         $this->config = ClientManager::get('options');
@@ -297,13 +297,13 @@  discard block
 block discarded – undo
297 297
      * @throws MethodNotFoundException
298 298
      */
299 299
     public function __call(string $method, array $arguments) {
300
-        if(strtolower(substr($method, 0, 3)) === 'get') {
300
+        if (strtolower(substr($method, 0, 3)) === 'get') {
301 301
             $name = Str::snake(substr($method, 3));
302 302
             return $this->get($name);
303 303
         }elseif (strtolower(substr($method, 0, 3)) === 'set') {
304 304
             $name = Str::snake(substr($method, 3));
305 305
 
306
-            if(in_array($name, array_keys($this->attributes))) {
306
+            if (in_array($name, array_keys($this->attributes))) {
307 307
                 return $this->__set($name, array_pop($arguments));
308 308
             }
309 309
 
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
      * @return Attribute|mixed|null
343 343
      */
344 344
     public function get($name) {
345
-        if(isset($this->attributes[$name])) {
345
+        if (isset($this->attributes[$name])) {
346 346
             return $this->attributes[$name];
347 347
         }
348 348
 
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
      *
417 417
      * @throws InvalidMessageDateException
418 418
      */
419
-    public function parseRawHeader(string $raw_header){
419
+    public function parseRawHeader(string $raw_header) {
420 420
         $this->header = new Header($raw_header);
421 421
     }
422 422
 
@@ -427,8 +427,8 @@  discard block
 block discarded – undo
427 427
     public function parseRawFlags(array $raw_flags) {
428 428
         $this->flags = FlagCollection::make([]);
429 429
 
430
-        foreach($raw_flags as $flag) {
431
-            if (strpos($flag, "\\") === 0){
430
+        foreach ($raw_flags as $flag) {
431
+            if (strpos($flag, "\\") === 0) {
432 432
                 $flag = substr($flag, 1);
433 433
             }
434 434
             $flag_key = strtolower($flag);
@@ -501,7 +501,7 @@  discard block
 block discarded – undo
501 501
      * @throws MessageFlagException
502 502
      * @throws Exceptions\RuntimeException
503 503
      */
504
-    public function peek(){
504
+    public function peek() {
505 505
         if ($this->fetch_options == IMAP::FT_PEEK) {
506 506
             if ($this->getFlags()->get("seen") == null) {
507 507
                 $this->unsetFlag("Seen");
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
     private function fetchPart(Part $part) {
551 551
         if ($part->isAttachment()) {
552 552
             $this->fetchAttachment($part);
553
-        }else{
553
+        }else {
554 554
             $encoding = $this->getEncoding($part);
555 555
 
556 556
             $content = $this->decodeString($part->content, $part->encoding);
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
 
576 576
             if (isset($this->bodies[$subtype])) {
577 577
                 $this->bodies[$subtype] .= "\n".$content;
578
-            }else{
578
+            }else {
579 579
                 $this->bodies[$subtype] = $content;
580 580
             }
581 581
         }
@@ -591,7 +591,7 @@  discard block
 block discarded – undo
591 591
         if ($oAttachment->getName() !== null && $oAttachment->getSize() > 0) {
592 592
             if ($oAttachment->getId() !== null) {
593 593
                 $this->attachments->put($oAttachment->getId(), $oAttachment);
594
-            } else {
594
+            }else {
595 595
                 $this->attachments->push($oAttachment);
596 596
             }
597 597
         }
@@ -725,7 +725,7 @@  discard block
 block discarded – undo
725 725
 
726 726
         if (function_exists('iconv') && $from != 'UTF-7' && $to != 'UTF-7') {
727 727
             return @iconv($from, $to.'//IGNORE', $str);
728
-        } else {
728
+        }else {
729 729
             if (!$from) {
730 730
                 return mb_convert_encoding($str, $to);
731 731
             }
@@ -746,9 +746,9 @@  discard block
 block discarded – undo
746 746
                     return EncodingAliases::get($parameter->value, "ISO-8859-2");
747 747
                 }
748 748
             }
749
-        }elseif (property_exists($structure, 'charset')){
749
+        }elseif (property_exists($structure, 'charset')) {
750 750
             return EncodingAliases::get($structure->charset, "ISO-8859-2");
751
-        }elseif (is_string($structure) === true){
751
+        }elseif (is_string($structure) === true) {
752 752
             return mb_detect_encoding($structure);
753 753
         }
754 754
 
@@ -763,7 +763,7 @@  discard block
 block discarded – undo
763 763
      * @throws Exceptions\FolderFetchingException
764 764
      * @throws Exceptions\RuntimeException
765 765
      */
766
-    public function getFolder(){
766
+    public function getFolder() {
767 767
         return $this->client->getFolderByPath($this->folder_path);
768 768
     }
769 769
 
@@ -779,13 +779,13 @@  discard block
 block discarded – undo
779 779
      * @throws Exceptions\GetMessagesFailedException
780 780
      * @throws Exceptions\RuntimeException
781 781
      */
782
-    public function thread(Folder $sent_folder = null, MessageCollection &$thread = null, Folder $folder = null): MessageCollection {
782
+    public function thread(Folder $sent_folder = null, MessageCollection & $thread = null, Folder $folder = null): MessageCollection {
783 783
         $thread = $thread ?: MessageCollection::make([]);
784
-        $folder = $folder ?:  $this->getFolder();
784
+        $folder = $folder ?: $this->getFolder();
785 785
         $sent_folder = $sent_folder ?: $this->client->getFolderByPath(ClientManager::get("options.common_folders.sent", "INBOX/Sent"));
786 786
 
787 787
         /** @var Message $message */
788
-        foreach($thread as $message) {
788
+        foreach ($thread as $message) {
789 789
             if ($message->message_id->first() == $this->message_id->first()) {
790 790
                 return $thread;
791 791
             }
@@ -796,7 +796,7 @@  discard block
 block discarded – undo
796 796
         $this->fetchThreadByInReplyTo($thread, $this->message_id, $sent_folder, $folder, $sent_folder);
797 797
 
798 798
         if (is_array($this->in_reply_to)) {
799
-            foreach($this->in_reply_to as $in_reply_to) {
799
+            foreach ($this->in_reply_to as $in_reply_to) {
800 800
                 $this->fetchThreadByMessageId($thread, $in_reply_to, $folder, $folder, $sent_folder);
801 801
                 $this->fetchThreadByMessageId($thread, $in_reply_to, $sent_folder, $folder, $sent_folder);
802 802
             }
@@ -818,7 +818,7 @@  discard block
 block discarded – undo
818 818
      * @throws Exceptions\RuntimeException
819 819
      * @throws Exceptions\FolderFetchingException
820 820
      */
821
-    protected function fetchThreadByInReplyTo(MessageCollection &$thread, string $in_reply_to, Folder $primary_folder, Folder $secondary_folder, Folder $sent_folder){
821
+    protected function fetchThreadByInReplyTo(MessageCollection & $thread, string $in_reply_to, Folder $primary_folder, Folder $secondary_folder, Folder $sent_folder) {
822 822
         $primary_folder->query()->inReplyTo($in_reply_to)
823 823
         ->setFetchBody($this->getFetchBodyOption())
824 824
         ->leaveUnread()->get()->each(function($message) use(&$thread, $secondary_folder, $sent_folder){
@@ -840,7 +840,7 @@  discard block
 block discarded – undo
840 840
      * @throws Exceptions\RuntimeException
841 841
      * @throws Exceptions\FolderFetchingException
842 842
      */
843
-    protected function fetchThreadByMessageId(MessageCollection &$thread, string $message_id, Folder $primary_folder, Folder $secondary_folder, Folder $sent_folder){
843
+    protected function fetchThreadByMessageId(MessageCollection & $thread, string $message_id, Folder $primary_folder, Folder $secondary_folder, Folder $sent_folder) {
844 844
         $primary_folder->query()->messageId($message_id)
845 845
         ->setFetchBody($this->getFetchBodyOption())
846 846
         ->leaveUnread()->get()->each(function($message) use(&$thread, $secondary_folder, $sent_folder){
@@ -937,13 +937,13 @@  discard block
 block discarded – undo
937 937
      * @throws MessageHeaderFetchingException
938 938
      */
939 939
     protected function fetchNewMail(Folder $folder, int $next_uid, string $event, bool $expunge): Message {
940
-        if($expunge) $this->client->expunge();
940
+        if ($expunge) $this->client->expunge();
941 941
 
942 942
         $this->client->openFolder($folder->path);
943 943
 
944 944
         if ($this->sequence === IMAP::ST_UID) {
945 945
             $sequence_id = $next_uid;
946
-        }else{
946
+        }else {
947 947
             $sequence_id = $this->client->getConnection()->getMessageNumber($next_uid);
948 948
         }
949 949
 
@@ -973,11 +973,11 @@  discard block
 block discarded – undo
973 973
      */
974 974
     public function delete(bool $expunge = true, string $trash_path = null, bool $force_move = false) {
975 975
         $status = $this->setFlag("Deleted");
976
-        if($force_move) {
977
-            $trash_path = $trash_path === null ? $this->config["common_folders"]["trash"]: $trash_path;
976
+        if ($force_move) {
977
+            $trash_path = $trash_path === null ? $this->config["common_folders"]["trash"] : $trash_path;
978 978
             $status = $this->move($trash_path);
979 979
         }
980
-        if($expunge) $this->client->expunge();
980
+        if ($expunge) $this->client->expunge();
981 981
 
982 982
         $event = $this->getEvent("message", "deleted");
983 983
         $event::dispatch($this);
@@ -997,7 +997,7 @@  discard block
 block discarded – undo
997 997
      */
998 998
     public function restore(bool $expunge = true): bool {
999 999
         $status = $this->unsetFlag("Deleted");
1000
-        if($expunge) $this->client->expunge();
1000
+        if ($expunge) $this->client->expunge();
1001 1001
 
1002 1002
         $event = $this->getEvent("message", "restored");
1003 1003
         $event::dispatch($this);
@@ -1029,7 +1029,7 @@  discard block
 block discarded – undo
1029 1029
         $event = $this->getEvent("flag", "new");
1030 1030
         $event::dispatch($this, $flag);
1031 1031
 
1032
-        return (bool)$status;
1032
+        return (bool) $status;
1033 1033
     }
1034 1034
 
1035 1035
     /**
@@ -1057,7 +1057,7 @@  discard block
 block discarded – undo
1057 1057
         $event = $this->getEvent("flag", "deleted");
1058 1058
         $event::dispatch($this, $flag);
1059 1059
 
1060
-        return (bool)$status;
1060
+        return (bool) $status;
1061 1061
     }
1062 1062
 
1063 1063
     /**
@@ -1209,7 +1209,7 @@  discard block
 block discarded – undo
1209 1209
      *
1210 1210
      * @return Structure|null
1211 1211
      */
1212
-    public function getStructure(){
1212
+    public function getStructure() {
1213 1213
         return $this->structure;
1214 1214
     }
1215 1215
 
@@ -1246,7 +1246,7 @@  discard block
 block discarded – undo
1246 1246
      * @return $this
1247 1247
      */
1248 1248
     public function setMask($mask): Message {
1249
-        if(class_exists($mask)){
1249
+        if (class_exists($mask)) {
1250 1250
             $this->mask = $mask;
1251 1251
         }
1252 1252
 
@@ -1269,9 +1269,9 @@  discard block
 block discarded – undo
1269 1269
      * @return mixed
1270 1270
      * @throws MaskNotFoundException
1271 1271
      */
1272
-    public function mask($mask = null){
1272
+    public function mask($mask = null) {
1273 1273
         $mask = $mask !== null ? $mask : $this->mask;
1274
-        if(class_exists($mask)){
1274
+        if (class_exists($mask)) {
1275 1275
             return new $mask($this);
1276 1276
         }
1277 1277
 
@@ -1421,11 +1421,11 @@  discard block
 block discarded – undo
1421 1421
      * @throws Exceptions\ConnectionFailedException
1422 1422
      * @throws Exceptions\MessageNotFoundException
1423 1423
      */
1424
-    public function setSequenceId($uid, int $msglist = null){
1424
+    public function setSequenceId($uid, int $msglist = null) {
1425 1425
         if ($this->getSequence() === IMAP::ST_UID) {
1426 1426
             $this->setUid($uid);
1427 1427
             $this->setMsglist($msglist);
1428
-        }else{
1428
+        }else {
1429 1429
             $this->setMsgn($uid, $msglist);
1430 1430
         }
1431 1431
     }
Please login to merge, or discard this patch.
src/Query/Query.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 
96 96
         if (ClientManager::get('options.fetch_order') === 'desc') {
97 97
             $this->fetch_order = 'desc';
98
-        } else {
98
+        }else {
99 99
             $this->fetch_order = 'asc';
100 100
         }
101 101
 
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
             $value = $value->format($this->date_format);
125 125
         }
126 126
 
127
-        return (string)$value;
127
+        return (string) $value;
128 128
     }
129 129
 
130 130
     /**
@@ -156,14 +156,14 @@  discard block
 block discarded – undo
156 156
         $this->query->each(function($statement) use (&$query) {
157 157
             if (count($statement) == 1) {
158 158
                 $query .= $statement[0];
159
-            } else {
159
+            }else {
160 160
                 if ($statement[1] === null) {
161 161
                     $query .= $statement[0];
162
-                } else {
162
+                }else {
163 163
                     if (is_numeric($statement[1])) {
164
-                        $query .= $statement[0] . ' ' . $statement[1];
165
-                    } else {
166
-                        $query .= $statement[0] . ' "' . $statement[1] . '"';
164
+                        $query .= $statement[0].' '.$statement[1];
165
+                    }else {
166
+                        $query .= $statement[0].' "'.$statement[1].'"';
167 167
                     }
168 168
                 }
169 169
             }
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
                 $key = $message->getMessageId();
298 298
                 break;
299 299
         }
300
-        return (string)$key;
300
+        return (string) $key;
301 301
     }
302 302
 
303 303
     /**
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
             $extensions = $raw_messages["extensions"][$uid] ?? [];
346 346
 
347 347
             $message = $this->make($uid, $msglist, $header, $content, $flag);
348
-            foreach($extensions as $key => $extension) {
348
+            foreach ($extensions as $key => $extension) {
349 349
                 $message->getHeader()->set($key, $extension);
350 350
             }
351 351
             if ($message !== null) {
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
         $uids = $connection->getUid();
498 498
         $available_messages = new Collection();
499 499
         if (is_array($uids)) {
500
-            foreach ($uids as $id){
500
+            foreach ($uids as $id) {
501 501
                 if ($closure($id)) {
502 502
                     $available_messages->push($id);
503 503
                 }
Please login to merge, or discard this patch.