Passed
Push — master ( 6e76b3...0897d6 )
by Malte
03:29
created
src/Support/Masks/Mask.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
     public function __construct($parent) {
44 44
         $this->parent = $parent;
45 45
 
46
-        if(method_exists($this->parent, 'getAttributes')){
46
+        if (method_exists($this->parent, 'getAttributes')) {
47 47
             $this->attributes = array_merge($this->attributes, $this->parent->getAttributes());
48 48
         }
49 49
 
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
     /**
54 54
      * Boot method made to be used by any custom mask
55 55
      */
56
-    protected function boot(){}
56
+    protected function boot() {}
57 57
 
58 58
     /**
59 59
      * Call dynamic attribute setter and getter methods and inherit the parent calls
@@ -64,17 +64,17 @@  discard block
 block discarded – undo
64 64
      * @throws MethodNotFoundException
65 65
      */
66 66
     public function __call(string $method, array $arguments) {
67
-        if(strtolower(substr($method, 0, 3)) === 'get') {
67
+        if (strtolower(substr($method, 0, 3)) === 'get') {
68 68
             $name = Str::snake(substr($method, 3));
69 69
 
70
-            if(isset($this->attributes[$name])) {
70
+            if (isset($this->attributes[$name])) {
71 71
                 return $this->attributes[$name];
72 72
             }
73 73
 
74 74
         }elseif (strtolower(substr($method, 0, 3)) === 'set') {
75 75
             $name = Str::snake(substr($method, 3));
76 76
 
77
-            if(isset($this->attributes[$name])) {
77
+            if (isset($this->attributes[$name])) {
78 78
                 $this->attributes[$name] = array_pop($arguments);
79 79
 
80 80
                 return $this->attributes[$name];
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 
83 83
         }
84 84
 
85
-        if(method_exists($this->parent, $method) === true){
85
+        if (method_exists($this->parent, $method) === true) {
86 86
             return call_user_func_array([$this->parent, $method], $arguments);
87 87
         }
88 88
 
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
      * @return mixed|null
110 110
      */
111 111
     public function __get($name) {
112
-        if(isset($this->attributes[$name])) {
112
+        if (isset($this->attributes[$name])) {
113 113
             return $this->attributes[$name];
114 114
         }
115 115
 
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
      *
122 122
      * @return object
123 123
      */
124
-    public function getParent(){
124
+    public function getParent() {
125 125
         return $this->parent;
126 126
     }
127 127
 
Please login to merge, or discard this patch.
src/Message.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
         $this->boot();
192 192
 
193 193
         $default_mask = $client->getDefaultMessageMask();
194
-        if($default_mask != null) {
194
+        if ($default_mask != null) {
195 195
             $this->mask = $default_mask;
196 196
         }
197 197
         $this->events["message"] = $client->getDefaultEvents("message");
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
         $instance->boot();
253 253
 
254 254
         $default_mask = $client->getDefaultMessageMask();
255
-        if($default_mask != null) {
255
+        if ($default_mask != null) {
256 256
             $instance->setMask($default_mask);
257 257
         }
258 258
         $instance->setEvents([
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
     /**
278 278
      * Boot a new instance
279 279
      */
280
-    public function boot(){
280
+    public function boot() {
281 281
         $this->attributes = [];
282 282
 
283 283
         $this->config = ClientManager::get('options');
@@ -296,13 +296,13 @@  discard block
 block discarded – undo
296 296
      * @throws MethodNotFoundException
297 297
      */
298 298
     public function __call(string $method, array $arguments) {
299
-        if(strtolower(substr($method, 0, 3)) === 'get') {
299
+        if (strtolower(substr($method, 0, 3)) === 'get') {
300 300
             $name = Str::snake(substr($method, 3));
301 301
             return $this->get($name);
302 302
         }elseif (strtolower(substr($method, 0, 3)) === 'set') {
303 303
             $name = Str::snake(substr($method, 3));
304 304
 
305
-            if(in_array($name, array_keys($this->attributes))) {
305
+            if (in_array($name, array_keys($this->attributes))) {
306 306
                 return $this->__set($name, array_pop($arguments));
307 307
             }
308 308
 
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
      * @return Attribute|mixed|null
342 342
      */
343 343
     public function get($name) {
344
-        if(isset($this->attributes[$name])) {
344
+        if (isset($this->attributes[$name])) {
345 345
             return $this->attributes[$name];
346 346
         }
347 347
 
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
      *
416 416
      * @throws InvalidMessageDateException
417 417
      */
418
-    public function parseRawHeader(string $raw_header){
418
+    public function parseRawHeader(string $raw_header) {
419 419
         $this->header = new Header($raw_header);
420 420
     }
421 421
 
@@ -426,8 +426,8 @@  discard block
 block discarded – undo
426 426
     public function parseRawFlags(array $raw_flags) {
427 427
         $this->flags = FlagCollection::make([]);
428 428
 
429
-        foreach($raw_flags as $flag) {
430
-            if (strpos($flag, "\\") === 0){
429
+        foreach ($raw_flags as $flag) {
430
+            if (strpos($flag, "\\") === 0) {
431 431
                 $flag = substr($flag, 1);
432 432
             }
433 433
             $flag_key = strtolower($flag);
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
      * @throws MessageFlagException
501 501
      * @throws Exceptions\RuntimeException
502 502
      */
503
-    public function peek(){
503
+    public function peek() {
504 504
         if ($this->fetch_options == IMAP::FT_PEEK) {
505 505
             if ($this->getFlags()->get("seen") == null) {
506 506
                 $this->unsetFlag("Seen");
@@ -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
         }
@@ -590,7 +590,7 @@  discard block
 block discarded – undo
590 590
         if ($oAttachment->getName() !== null && $oAttachment->getSize() > 0) {
591 591
             if ($oAttachment->getId() !== null) {
592 592
                 $this->attachments->put($oAttachment->getId(), $oAttachment);
593
-            } else {
593
+            }else {
594 594
                 $this->attachments->push($oAttachment);
595 595
             }
596 596
         }
@@ -724,7 +724,7 @@  discard block
 block discarded – undo
724 724
 
725 725
         if (function_exists('iconv') && $from != 'UTF-7' && $to != 'UTF-7') {
726 726
             return @iconv($from, $to.'//IGNORE', $str);
727
-        } else {
727
+        }else {
728 728
             if (!$from) {
729 729
                 return mb_convert_encoding($str, $to);
730 730
             }
@@ -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
 
@@ -762,7 +762,7 @@  discard block
 block discarded – undo
762 762
      * @throws Exceptions\FolderFetchingException
763 763
      * @throws Exceptions\RuntimeException
764 764
      */
765
-    public function getFolder(){
765
+    public function getFolder() {
766 766
         return $this->client->getFolderByPath($this->folder_path);
767 767
     }
768 768
 
@@ -778,13 +778,13 @@  discard block
 block discarded – undo
778 778
      * @throws Exceptions\GetMessagesFailedException
779 779
      * @throws Exceptions\RuntimeException
780 780
      */
781
-    public function thread(Folder $sent_folder = null, MessageCollection &$thread = null, Folder $folder = null): MessageCollection {
781
+    public function thread(Folder $sent_folder = null, MessageCollection & $thread = null, Folder $folder = null): MessageCollection {
782 782
         $thread = $thread ?: MessageCollection::make([]);
783
-        $folder = $folder ?:  $this->getFolder();
783
+        $folder = $folder ?: $this->getFolder();
784 784
         $sent_folder = $sent_folder ?: $this->client->getFolderByPath(ClientManager::get("options.common_folders.sent", "INBOX/Sent"));
785 785
 
786 786
         /** @var Message $message */
787
-        foreach($thread as $message) {
787
+        foreach ($thread as $message) {
788 788
             if ($message->message_id->first() == $this->message_id->first()) {
789 789
                 return $thread;
790 790
             }
@@ -795,7 +795,7 @@  discard block
 block discarded – undo
795 795
         $this->fetchThreadByInReplyTo($thread, $this->message_id, $sent_folder, $folder, $sent_folder);
796 796
 
797 797
         if (is_array($this->in_reply_to)) {
798
-            foreach($this->in_reply_to as $in_reply_to) {
798
+            foreach ($this->in_reply_to as $in_reply_to) {
799 799
                 $this->fetchThreadByMessageId($thread, $in_reply_to, $folder, $folder, $sent_folder);
800 800
                 $this->fetchThreadByMessageId($thread, $in_reply_to, $sent_folder, $folder, $sent_folder);
801 801
             }
@@ -817,7 +817,7 @@  discard block
 block discarded – undo
817 817
      * @throws Exceptions\RuntimeException
818 818
      * @throws Exceptions\FolderFetchingException
819 819
      */
820
-    protected function fetchThreadByInReplyTo(MessageCollection &$thread, string $in_reply_to, Folder $primary_folder, Folder $secondary_folder, Folder $sent_folder){
820
+    protected function fetchThreadByInReplyTo(MessageCollection & $thread, string $in_reply_to, Folder $primary_folder, Folder $secondary_folder, Folder $sent_folder) {
821 821
         $primary_folder->query()->inReplyTo($in_reply_to)
822 822
         ->setFetchBody($this->getFetchBodyOption())
823 823
         ->leaveUnread()->get()->each(function($message) use(&$thread, $secondary_folder, $sent_folder){
@@ -839,7 +839,7 @@  discard block
 block discarded – undo
839 839
      * @throws Exceptions\RuntimeException
840 840
      * @throws Exceptions\FolderFetchingException
841 841
      */
842
-    protected function fetchThreadByMessageId(MessageCollection &$thread, string $message_id, Folder $primary_folder, Folder $secondary_folder, Folder $sent_folder){
842
+    protected function fetchThreadByMessageId(MessageCollection & $thread, string $message_id, Folder $primary_folder, Folder $secondary_folder, Folder $sent_folder) {
843 843
         $primary_folder->query()->messageId($message_id)
844 844
         ->setFetchBody($this->getFetchBodyOption())
845 845
         ->leaveUnread()->get()->each(function($message) use(&$thread, $secondary_folder, $sent_folder){
@@ -936,13 +936,13 @@  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) $this->client->expunge();
940 940
 
941 941
         $this->client->openFolder($folder->path);
942 942
 
943 943
         if ($this->sequence === IMAP::ST_UID) {
944 944
             $sequence_id = $next_uid;
945
-        }else{
945
+        }else {
946 946
             $sequence_id = $this->client->getConnection()->getMessageNumber($next_uid);
947 947
         }
948 948
 
@@ -972,11 +972,11 @@  discard block
 block discarded – undo
972 972
      */
973 973
     public function delete(bool $expunge = true, string $trash_path = null, bool $force_move = false) {
974 974
         $status = $this->setFlag("Deleted");
975
-        if($force_move) {
976
-            $trash_path = $trash_path === null ? $this->config["common_folders"]["trash"]: $trash_path;
975
+        if ($force_move) {
976
+            $trash_path = $trash_path === null ? $this->config["common_folders"]["trash"] : $trash_path;
977 977
             $status = $this->move($trash_path);
978 978
         }
979
-        if($expunge) $this->client->expunge();
979
+        if ($expunge) $this->client->expunge();
980 980
 
981 981
         $event = $this->getEvent("message", "deleted");
982 982
         $event::dispatch($this);
@@ -996,7 +996,7 @@  discard block
 block discarded – undo
996 996
      */
997 997
     public function restore(bool $expunge = true): bool {
998 998
         $status = $this->unsetFlag("Deleted");
999
-        if($expunge) $this->client->expunge();
999
+        if ($expunge) $this->client->expunge();
1000 1000
 
1001 1001
         $event = $this->getEvent("message", "restored");
1002 1002
         $event::dispatch($this);
@@ -1208,7 +1208,7 @@  discard block
 block discarded – undo
1208 1208
      *
1209 1209
      * @return Structure|null
1210 1210
      */
1211
-    public function getStructure(){
1211
+    public function getStructure() {
1212 1212
         return $this->structure;
1213 1213
     }
1214 1214
 
@@ -1245,7 +1245,7 @@  discard block
 block discarded – undo
1245 1245
      * @return $this
1246 1246
      */
1247 1247
     public function setMask($mask): Message {
1248
-        if(class_exists($mask)){
1248
+        if (class_exists($mask)) {
1249 1249
             $this->mask = $mask;
1250 1250
         }
1251 1251
 
@@ -1268,9 +1268,9 @@  discard block
 block discarded – undo
1268 1268
      * @return mixed
1269 1269
      * @throws MaskNotFoundException
1270 1270
      */
1271
-    public function mask($mask = null){
1271
+    public function mask($mask = null) {
1272 1272
         $mask = $mask !== null ? $mask : $this->mask;
1273
-        if(class_exists($mask)){
1273
+        if (class_exists($mask)) {
1274 1274
             return new $mask($this);
1275 1275
         }
1276 1276
 
@@ -1420,11 +1420,11 @@  discard block
 block discarded – undo
1420 1420
      * @throws Exceptions\ConnectionFailedException
1421 1421
      * @throws Exceptions\MessageNotFoundException
1422 1422
      */
1423
-    public function setSequenceId($uid, int $msglist = null){
1423
+    public function setSequenceId($uid, int $msglist = null) {
1424 1424
         if ($this->getSequence() === IMAP::ST_UID) {
1425 1425
             $this->setUid($uid);
1426 1426
             $this->setMsglist($msglist);
1427
-        }else{
1427
+        }else {
1428 1428
             $this->setMsgn($uid, $msglist);
1429 1429
         }
1430 1430
     }
Please login to merge, or discard this patch.