Passed
Push — master ( 4b6ca8...7b77e0 )
by Malte
02:34
created
src/Message.php 2 patches
Braces   +16 added lines, -8 removed lines patch added patch discarded remove patch
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
         if(strtolower(substr($method, 0, 3)) === 'get') {
245 245
             $name = Str::snake(substr($method, 3));
246 246
             return $this->get($name);
247
-        }elseif (strtolower(substr($method, 0, 3)) === 'set') {
247
+        } elseif (strtolower(substr($method, 0, 3)) === 'set') {
248 248
             $name = Str::snake(substr($method, 3));
249 249
 
250 250
             if(in_array($name, array_keys($this->attributes))) {
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
 
441 441
         if ($part->isAttachment()) {
442 442
             $this->fetchAttachment($part);
443
-        }else{
443
+        } else{
444 444
             $encoding = $this->getEncoding($part);
445 445
 
446 446
             $content = $this->decodeString($part->content, $part->encoding);
@@ -616,9 +616,9 @@  discard block
 block discarded – undo
616 616
                     return EncodingAliases::get($parameter->value);
617 617
                 }
618 618
             }
619
-        }elseif (property_exists($structure, 'charset')){
619
+        } elseif (property_exists($structure, 'charset')){
620 620
             return EncodingAliases::get($structure->charset);
621
-        }elseif (is_string($structure) === true){
621
+        } elseif (is_string($structure) === true){
622 622
             return mb_detect_encoding($structure);
623 623
         }
624 624
 
@@ -719,7 +719,9 @@  discard block
 block discarded – undo
719 719
 
720 720
             $this->client->openFolder($this->folder_path);
721 721
             if ($this->client->getConnection()->copyMessage($folder->path, $this->msgn) == true) {
722
-                if($expunge) $this->client->expunge();
722
+                if($expunge) {
723
+                    $this->client->expunge();
724
+                }
723 725
 
724 726
                 $this->client->openFolder($folder->path);
725 727
                 $message_num = $this->client->getConnection()->getMessageNumber($next_uid);
@@ -761,7 +763,9 @@  discard block
 block discarded – undo
761 763
 
762 764
             $this->client->openFolder($this->folder_path);
763 765
             if ($this->client->getConnection()->moveMessage($folder->path, $this->msgn) == true) {
764
-                if($expunge) $this->client->expunge();
766
+                if($expunge) {
767
+                    $this->client->expunge();
768
+                }
765 769
 
766 770
                 $this->client->openFolder($folder->path);
767 771
                 $message_num = $this->client->getConnection()->getMessageNumber($next_uid);
@@ -788,7 +792,9 @@  discard block
 block discarded – undo
788 792
      */
789 793
     public function delete($expunge = true) {
790 794
         $status = $this->setFlag("Deleted");
791
-        if($expunge) $this->client->expunge();
795
+        if($expunge) {
796
+            $this->client->expunge();
797
+        }
792 798
 
793 799
         $event = $this->getEvent("message", "deleted");
794 800
         $event::dispatch($this);
@@ -807,7 +813,9 @@  discard block
 block discarded – undo
807 813
      */
808 814
     public function restore($expunge = true) {
809 815
         $status = $this->unsetFlag("Deleted");
810
-        if($expunge) $this->client->expunge();
816
+        if($expunge) {
817
+            $this->client->expunge();
818
+        }
811 819
 
812 820
         $event = $this->getEvent("message", "restored");
813 821
         $event::dispatch($this);
Please login to merge, or discard this patch.
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
     public function __construct($msgn, $msglist, Client $client, $fetch_options = null, $fetch_body = false, $fetch_flags = false) {
196 196
 
197 197
         $default_mask = $client->getDefaultMessageMask();
198
-        if($default_mask != null) {
198
+        if ($default_mask != null) {
199 199
             $this->mask = $default_mask;
200 200
         }
201 201
         $this->events["message"] = $client->getDefaultEvents("message");
@@ -249,13 +249,13 @@  discard block
 block discarded – undo
249 249
      * @throws MessageContentFetchingException
250 250
      * @throws \ReflectionException
251 251
      */
252
-    public static function make($msgn, $msglist, Client $client, $raw_header, $raw_body, $raw_flags, $fetch_options = null){
252
+    public static function make($msgn, $msglist, Client $client, $raw_header, $raw_body, $raw_flags, $fetch_options = null) {
253 253
         $reflection = new \ReflectionClass(self::class);
254 254
         /** @var self $instance */
255 255
         $instance = $reflection->newInstanceWithoutConstructor();
256 256
 
257 257
         $default_mask = $client->getDefaultMessageMask();
258
-        if($default_mask != null) {
258
+        if ($default_mask != null) {
259 259
             $instance->setMask($default_mask);
260 260
         }
261 261
         $instance->setEvents([
@@ -287,13 +287,13 @@  discard block
 block discarded – undo
287 287
      * @throws MethodNotFoundException
288 288
      */
289 289
     public function __call($method, $arguments) {
290
-        if(strtolower(substr($method, 0, 3)) === 'get') {
290
+        if (strtolower(substr($method, 0, 3)) === 'get') {
291 291
             $name = Str::snake(substr($method, 3));
292 292
             return $this->get($name);
293 293
         }elseif (strtolower(substr($method, 0, 3)) === 'set') {
294 294
             $name = Str::snake(substr($method, 3));
295 295
 
296
-            if(in_array($name, array_keys($this->attributes))) {
296
+            if (in_array($name, array_keys($this->attributes))) {
297 297
                 $this->attributes[$name] = array_pop($arguments);
298 298
 
299 299
                 return $this->attributes[$name];
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
      * @return mixed|null
335 335
      */
336 336
     public function get($name) {
337
-        if(isset($this->attributes[$name])) {
337
+        if (isset($this->attributes[$name])) {
338 338
             return $this->attributes[$name];
339 339
         }
340 340
 
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
      *
408 408
      * @throws InvalidMessageDateException
409 409
      */
410
-    public function parseRawHeader($raw_header){
410
+    public function parseRawHeader($raw_header) {
411 411
         $this->header = new Header($raw_header);
412 412
     }
413 413
 
@@ -418,8 +418,8 @@  discard block
 block discarded – undo
418 418
     public function parseRawFlags($raw_flags) {
419 419
         $this->flags = FlagCollection::make([]);
420 420
 
421
-        foreach($raw_flags as $flag) {
422
-            if (strpos($flag, "\\") === 0){
421
+        foreach ($raw_flags as $flag) {
422
+            if (strpos($flag, "\\") === 0) {
423 423
                 $flag = substr($flag, 1);
424 424
             }
425 425
             $flag_key = strtolower($flag);
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
 
521 521
         if ($part->isAttachment()) {
522 522
             $this->fetchAttachment($part);
523
-        }else{
523
+        }else {
524 524
             $encoding = $this->getEncoding($part);
525 525
 
526 526
             $content = $this->decodeString($part->content, $part->encoding);
@@ -558,7 +558,7 @@  discard block
 block discarded – undo
558 558
         if ($oAttachment->getName() !== null && $oAttachment->getSize() > 0) {
559 559
             if ($oAttachment->getId() !== null) {
560 560
                 $this->attachments->put($oAttachment->getId(), $oAttachment);
561
-            } else {
561
+            }else {
562 562
                 $this->attachments->push($oAttachment);
563 563
             }
564 564
         }
@@ -675,7 +675,7 @@  discard block
 block discarded – undo
675 675
 
676 676
         if (function_exists('iconv') && $from != 'UTF-7' && $to != 'UTF-7') {
677 677
             return @iconv($from, $to.'//IGNORE', $str);
678
-        } else {
678
+        }else {
679 679
             if (!$from) {
680 680
                 return mb_convert_encoding($str, $to);
681 681
             }
@@ -696,9 +696,9 @@  discard block
 block discarded – undo
696 696
                     return EncodingAliases::get($parameter->value);
697 697
                 }
698 698
             }
699
-        }elseif (property_exists($structure, 'charset')){
699
+        }elseif (property_exists($structure, 'charset')) {
700 700
             return EncodingAliases::get($structure->charset);
701
-        }elseif (is_string($structure) === true){
701
+        }elseif (is_string($structure) === true) {
702 702
             return mb_detect_encoding($structure);
703 703
         }
704 704
 
@@ -712,7 +712,7 @@  discard block
 block discarded – undo
712 712
      * @throws Exceptions\ConnectionFailedException
713 713
      * @throws Exceptions\FolderFetchingException
714 714
      */
715
-    public function getFolder(){
715
+    public function getFolder() {
716 716
         return $this->client->getFolder($this->folder_path);
717 717
     }
718 718
 
@@ -727,13 +727,13 @@  discard block
 block discarded – undo
727 727
      * @throws Exceptions\FolderFetchingException
728 728
      * @throws Exceptions\GetMessagesFailedException
729 729
      */
730
-    public function thread($sent_folder = null, &$thread = null, $folder = null){
730
+    public function thread($sent_folder = null, &$thread = null, $folder = null) {
731 731
         $thread = $thread ? $thread : MessageCollection::make([]);
732
-        $folder = $folder ? $folder :  $this->getFolder();
732
+        $folder = $folder ? $folder : $this->getFolder();
733 733
         $sent_folder = $sent_folder ? $sent_folder : $this->client->getFolder(ClientManager::get("options.common_folders.sent", "INBOX/Sent"));
734 734
 
735 735
         /** @var Message $message */
736
-        foreach($thread as $message) {
736
+        foreach ($thread as $message) {
737 737
             if ($message->message_id == $this->message_id) {
738 738
                 return $thread;
739 739
             }
@@ -754,7 +754,7 @@  discard block
 block discarded – undo
754 754
         });
755 755
 
756 756
         if (is_array($this->in_reply_to)) {
757
-            foreach($this->in_reply_to as $in_reply_to) {
757
+            foreach ($this->in_reply_to as $in_reply_to) {
758 758
                 $folder->query()->messageId($in_reply_to)
759 759
                     ->setFetchBody($this->getFetchBodyOption())
760 760
                     ->leaveUnread()->get()->each(function($message) use(&$thread, $folder, $sent_folder){
@@ -799,7 +799,7 @@  discard block
 block discarded – undo
799 799
 
800 800
             $this->client->openFolder($this->folder_path);
801 801
             if ($this->client->getConnection()->copyMessage($folder->path, $this->msgn) == true) {
802
-                if($expunge) $this->client->expunge();
802
+                if ($expunge) $this->client->expunge();
803 803
 
804 804
                 $this->client->openFolder($folder->path);
805 805
                 $message_num = $this->client->getConnection()->getMessageNumber($next_uid);
@@ -841,7 +841,7 @@  discard block
 block discarded – undo
841 841
 
842 842
             $this->client->openFolder($this->folder_path);
843 843
             if ($this->client->getConnection()->moveMessage($folder->path, $this->msgn) == true) {
844
-                if($expunge) $this->client->expunge();
844
+                if ($expunge) $this->client->expunge();
845 845
 
846 846
                 $this->client->openFolder($folder->path);
847 847
                 $message_num = $this->client->getConnection()->getMessageNumber($next_uid);
@@ -868,7 +868,7 @@  discard block
 block discarded – undo
868 868
      */
869 869
     public function delete($expunge = true) {
870 870
         $status = $this->setFlag("Deleted");
871
-        if($expunge) $this->client->expunge();
871
+        if ($expunge) $this->client->expunge();
872 872
 
873 873
         $event = $this->getEvent("message", "deleted");
874 874
         $event::dispatch($this);
@@ -887,7 +887,7 @@  discard block
 block discarded – undo
887 887
      */
888 888
     public function restore($expunge = true) {
889 889
         $status = $this->unsetFlag("Deleted");
890
-        if($expunge) $this->client->expunge();
890
+        if ($expunge) $this->client->expunge();
891 891
 
892 892
         $event = $this->getEvent("message", "restored");
893 893
         $event::dispatch($this);
@@ -1040,7 +1040,7 @@  discard block
 block discarded – undo
1040 1040
      *
1041 1041
      * @return object|null
1042 1042
      */
1043
-    public function getStructure(){
1043
+    public function getStructure() {
1044 1044
         return $this->structure;
1045 1045
     }
1046 1046
 
@@ -1066,7 +1066,7 @@  discard block
 block discarded – undo
1066 1066
      *
1067 1067
      * @return array
1068 1068
      */
1069
-    public function getAttributes(){
1069
+    public function getAttributes() {
1070 1070
         return array_merge($this->attributes, $this->header->getAttributes());
1071 1071
     }
1072 1072
 
@@ -1076,8 +1076,8 @@  discard block
 block discarded – undo
1076 1076
      *
1077 1077
      * @return $this
1078 1078
      */
1079
-    public function setMask($mask){
1080
-        if(class_exists($mask)){
1079
+    public function setMask($mask) {
1080
+        if (class_exists($mask)) {
1081 1081
             $this->mask = $mask;
1082 1082
         }
1083 1083
 
@@ -1089,7 +1089,7 @@  discard block
 block discarded – undo
1089 1089
      *
1090 1090
      * @return string
1091 1091
      */
1092
-    public function getMask(){
1092
+    public function getMask() {
1093 1093
         return $this->mask;
1094 1094
     }
1095 1095
 
@@ -1100,9 +1100,9 @@  discard block
 block discarded – undo
1100 1100
      * @return mixed
1101 1101
      * @throws MaskNotFoundException
1102 1102
      */
1103
-    public function mask($mask = null){
1103
+    public function mask($mask = null) {
1104 1104
         $mask = $mask !== null ? $mask : $this->mask;
1105
-        if(class_exists($mask)){
1105
+        if (class_exists($mask)) {
1106 1106
             return new $mask($this);
1107 1107
         }
1108 1108
 
@@ -1115,7 +1115,7 @@  discard block
 block discarded – undo
1115 1115
      *
1116 1116
      * @return $this
1117 1117
      */
1118
-    public function setFolderPath($folder_path){
1118
+    public function setFolderPath($folder_path) {
1119 1119
         $this->folder_path = $folder_path;
1120 1120
 
1121 1121
         return $this;
@@ -1127,7 +1127,7 @@  discard block
 block discarded – undo
1127 1127
      *
1128 1128
      * @return $this
1129 1129
      */
1130
-    public function setConfig($config){
1130
+    public function setConfig($config) {
1131 1131
         $this->config = $config;
1132 1132
 
1133 1133
         return $this;
@@ -1139,7 +1139,7 @@  discard block
 block discarded – undo
1139 1139
      *
1140 1140
      * @return $this
1141 1141
      */
1142
-    public function setAttachments($attachments){
1142
+    public function setAttachments($attachments) {
1143 1143
         $this->attachments = $attachments;
1144 1144
 
1145 1145
         return $this;
@@ -1151,7 +1151,7 @@  discard block
 block discarded – undo
1151 1151
      *
1152 1152
      * @return $this
1153 1153
      */
1154
-    public function setFlags($flags){
1154
+    public function setFlags($flags) {
1155 1155
         $this->flags = $flags;
1156 1156
 
1157 1157
         return $this;
@@ -1164,7 +1164,7 @@  discard block
 block discarded – undo
1164 1164
      * @throws Exceptions\ConnectionFailedException
1165 1165
      * @return $this
1166 1166
      */
1167
-    public function setClient($client){
1167
+    public function setClient($client) {
1168 1168
         $this->client = $client;
1169 1169
         $this->client->openFolder($this->folder_path);
1170 1170
 
@@ -1180,7 +1180,7 @@  discard block
 block discarded – undo
1180 1180
      * @throws Exceptions\RuntimeException
1181 1181
      * @return $this
1182 1182
      */
1183
-    public function setMsgn($msgn, $msglist = null){
1183
+    public function setMsgn($msgn, $msglist = null) {
1184 1184
         $this->msgn = $msgn;
1185 1185
         $this->msglist = $msglist;
1186 1186
 
Please login to merge, or discard this patch.