Passed
Push — master ( 17f7bb...ab922f )
by Malte
02:36
created
src/Message.php 2 patches
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
     public function __construct($uid, $msglist, Client $client, $fetch_options = null, $fetch_body = false, $fetch_flags = false, $sequence = null) {
203 203
 
204 204
         $default_mask = $client->getDefaultMessageMask();
205
-        if($default_mask != null) {
205
+        if ($default_mask != null) {
206 206
             $this->mask = $default_mask;
207 207
         }
208 208
         $this->events["message"] = $client->getDefaultEvents("message");
@@ -261,13 +261,13 @@  discard block
 block discarded – undo
261 261
      * @throws MessageFlagException
262 262
      * @throws Exceptions\RuntimeException
263 263
      */
264
-    public static function make($uid, $msglist, Client $client, $raw_header, $raw_body, $raw_flags, $fetch_options = null, $sequence = null){
264
+    public static function make($uid, $msglist, Client $client, $raw_header, $raw_body, $raw_flags, $fetch_options = null, $sequence = null) {
265 265
         $reflection = new \ReflectionClass(self::class);
266 266
         /** @var self $instance */
267 267
         $instance = $reflection->newInstanceWithoutConstructor();
268 268
 
269 269
         $default_mask = $client->getDefaultMessageMask();
270
-        if($default_mask != null) {
270
+        if ($default_mask != null) {
271 271
             $instance->setMask($default_mask);
272 272
         }
273 273
         $instance->setEvents([
@@ -302,13 +302,13 @@  discard block
 block discarded – undo
302 302
      * @throws MethodNotFoundException
303 303
      */
304 304
     public function __call($method, $arguments) {
305
-        if(strtolower(substr($method, 0, 3)) === 'get') {
305
+        if (strtolower(substr($method, 0, 3)) === 'get') {
306 306
             $name = Str::snake(substr($method, 3));
307 307
             return $this->get($name);
308 308
         }elseif (strtolower(substr($method, 0, 3)) === 'set') {
309 309
             $name = Str::snake(substr($method, 3));
310 310
 
311
-            if(in_array($name, array_keys($this->attributes))) {
311
+            if (in_array($name, array_keys($this->attributes))) {
312 312
                 return $this->__set($name, array_pop($arguments));
313 313
             }
314 314
 
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
      * @return mixed|null
348 348
      */
349 349
     public function get($name) {
350
-        if(isset($this->attributes[$name])) {
350
+        if (isset($this->attributes[$name])) {
351 351
             return $this->attributes[$name];
352 352
         }
353 353
 
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
      *
422 422
      * @throws InvalidMessageDateException
423 423
      */
424
-    public function parseRawHeader($raw_header){
424
+    public function parseRawHeader($raw_header) {
425 425
         $this->header = new Header($raw_header);
426 426
     }
427 427
 
@@ -432,8 +432,8 @@  discard block
 block discarded – undo
432 432
     public function parseRawFlags($raw_flags) {
433 433
         $this->flags = FlagCollection::make([]);
434 434
 
435
-        foreach($raw_flags as $flag) {
436
-            if (strpos($flag, "\\") === 0){
435
+        foreach ($raw_flags as $flag) {
436
+            if (strpos($flag, "\\") === 0) {
437 437
                 $flag = substr($flag, 1);
438 438
             }
439 439
             $flag_key = strtolower($flag);
@@ -506,7 +506,7 @@  discard block
 block discarded – undo
506 506
      * @throws MessageFlagException
507 507
      * @throws Exceptions\RuntimeException
508 508
      */
509
-    public function peek(){
509
+    public function peek() {
510 510
         if ($this->fetch_options == IMAP::FT_PEEK) {
511 511
             if ($this->getFlags()->get("seen") == null) {
512 512
                 $this->unsetFlag("Seen");
@@ -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
         }
@@ -596,7 +596,7 @@  discard block
 block discarded – undo
596 596
         if ($oAttachment->getName() !== null && $oAttachment->getSize() > 0) {
597 597
             if ($oAttachment->getId() !== null) {
598 598
                 $this->attachments->put($oAttachment->getId(), $oAttachment);
599
-            } else {
599
+            }else {
600 600
                 $this->attachments->push($oAttachment);
601 601
             }
602 602
         }
@@ -730,7 +730,7 @@  discard block
 block discarded – undo
730 730
 
731 731
         if (function_exists('iconv') && $from != 'UTF-7' && $to != 'UTF-7') {
732 732
             return @iconv($from, $to.'//IGNORE', $str);
733
-        } else {
733
+        }else {
734 734
             if (!$from) {
735 735
                 return mb_convert_encoding($str, $to);
736 736
             }
@@ -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
 
@@ -768,7 +768,7 @@  discard block
 block discarded – undo
768 768
      * @throws Exceptions\FolderFetchingException
769 769
      * @throws Exceptions\RuntimeException
770 770
      */
771
-    public function getFolder(){
771
+    public function getFolder() {
772 772
         return $this->client->getFolder($this->folder_path);
773 773
     }
774 774
 
@@ -784,13 +784,13 @@  discard block
 block discarded – undo
784 784
      * @throws Exceptions\GetMessagesFailedException
785 785
      * @throws Exceptions\RuntimeException
786 786
      */
787
-    public function thread($sent_folder = null, &$thread = null, $folder = null){
787
+    public function thread($sent_folder = null, &$thread = null, $folder = null) {
788 788
         $thread = $thread ? $thread : MessageCollection::make([]);
789
-        $folder = $folder ? $folder :  $this->getFolder();
789
+        $folder = $folder ? $folder : $this->getFolder();
790 790
         $sent_folder = $sent_folder ? $sent_folder : $this->client->getFolder(ClientManager::get("options.common_folders.sent", "INBOX/Sent"));
791 791
 
792 792
         /** @var Message $message */
793
-        foreach($thread as $message) {
793
+        foreach ($thread as $message) {
794 794
             if ($message->message_id == $this->message_id) {
795 795
                 return $thread;
796 796
             }
@@ -801,7 +801,7 @@  discard block
 block discarded – undo
801 801
         $this->fetchThreadByInReplyTo($thread, $this->message_id, $sent_folder, $folder, $sent_folder);
802 802
 
803 803
         if (is_array($this->in_reply_to)) {
804
-            foreach($this->in_reply_to as $in_reply_to) {
804
+            foreach ($this->in_reply_to as $in_reply_to) {
805 805
                 $this->fetchThreadByMessageId($thread, $in_reply_to, $folder, $folder, $sent_folder);
806 806
                 $this->fetchThreadByMessageId($thread, $in_reply_to, $sent_folder, $folder, $sent_folder);
807 807
             }
@@ -822,7 +822,7 @@  discard block
 block discarded – undo
822 822
      * @throws Exceptions\GetMessagesFailedException
823 823
      * @throws Exceptions\RuntimeException
824 824
      */
825
-    protected function fetchThreadByInReplyTo(&$thread, $in_reply_to, $primary_folder, $secondary_folder, $sent_folder){
825
+    protected function fetchThreadByInReplyTo(&$thread, $in_reply_to, $primary_folder, $secondary_folder, $sent_folder) {
826 826
         $primary_folder->query()->inReplyTo($in_reply_to)
827 827
         ->setFetchBody($this->getFetchBodyOption())
828 828
         ->leaveUnread()->get()->each(function($message) use(&$thread, $secondary_folder, $sent_folder){
@@ -843,7 +843,7 @@  discard block
 block discarded – undo
843 843
      * @throws Exceptions\GetMessagesFailedException
844 844
      * @throws Exceptions\RuntimeException
845 845
      */
846
-    protected function fetchThreadByMessageId(&$thread, $message_id, $primary_folder, $secondary_folder, $sent_folder){
846
+    protected function fetchThreadByMessageId(&$thread, $message_id, $primary_folder, $secondary_folder, $sent_folder) {
847 847
         $primary_folder->query()->messageId($message_id)
848 848
         ->setFetchBody($this->getFetchBodyOption())
849 849
         ->leaveUnread()->get()->each(function($message) use(&$thread, $secondary_folder, $sent_folder){
@@ -936,14 +936,14 @@  discard block
 block discarded – undo
936 936
      * @throws MessageFlagException
937 937
      * @throws MessageHeaderFetchingException
938 938
      */
939
-    protected function fetchNewMail($folder, $next_uid, $event, $expunge){
940
-        if($expunge) $this->client->expunge();
939
+    protected function fetchNewMail($folder, $next_uid, $event, $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
 
@@ -966,7 +966,7 @@  discard block
 block discarded – undo
966 966
      */
967 967
     public function delete($expunge = true) {
968 968
         $status = $this->setFlag("Deleted");
969
-        if($expunge) $this->client->expunge();
969
+        if ($expunge) $this->client->expunge();
970 970
 
971 971
         $event = $this->getEvent("message", "deleted");
972 972
         $event::dispatch($this);
@@ -986,7 +986,7 @@  discard block
 block discarded – undo
986 986
      */
987 987
     public function restore($expunge = true) {
988 988
         $status = $this->unsetFlag("Deleted");
989
-        if($expunge) $this->client->expunge();
989
+        if ($expunge) $this->client->expunge();
990 990
 
991 991
         $event = $this->getEvent("message", "restored");
992 992
         $event::dispatch($this);
@@ -1091,7 +1091,7 @@  discard block
 block discarded – undo
1091 1091
      *
1092 1092
      * @return AttachmentCollection
1093 1093
      */
1094
-    public function attachments(){
1094
+    public function attachments() {
1095 1095
         return $this->getAttachments();
1096 1096
     }
1097 1097
 
@@ -1189,7 +1189,7 @@  discard block
 block discarded – undo
1189 1189
      *
1190 1190
      * @return FlagCollection
1191 1191
      */
1192
-    public function flags(){
1192
+    public function flags() {
1193 1193
         return $this->getFlags();
1194 1194
     }
1195 1195
 
@@ -1198,7 +1198,7 @@  discard block
 block discarded – undo
1198 1198
      *
1199 1199
      * @return Structure|null
1200 1200
      */
1201
-    public function getStructure(){
1201
+    public function getStructure() {
1202 1202
         return $this->structure;
1203 1203
     }
1204 1204
 
@@ -1224,7 +1224,7 @@  discard block
 block discarded – undo
1224 1224
      *
1225 1225
      * @return array
1226 1226
      */
1227
-    public function getAttributes(){
1227
+    public function getAttributes() {
1228 1228
         return array_merge($this->attributes, $this->header->getAttributes());
1229 1229
     }
1230 1230
 
@@ -1234,8 +1234,8 @@  discard block
 block discarded – undo
1234 1234
      *
1235 1235
      * @return $this
1236 1236
      */
1237
-    public function setMask($mask){
1238
-        if(class_exists($mask)){
1237
+    public function setMask($mask) {
1238
+        if (class_exists($mask)) {
1239 1239
             $this->mask = $mask;
1240 1240
         }
1241 1241
 
@@ -1247,7 +1247,7 @@  discard block
 block discarded – undo
1247 1247
      *
1248 1248
      * @return string
1249 1249
      */
1250
-    public function getMask(){
1250
+    public function getMask() {
1251 1251
         return $this->mask;
1252 1252
     }
1253 1253
 
@@ -1258,9 +1258,9 @@  discard block
 block discarded – undo
1258 1258
      * @return mixed
1259 1259
      * @throws MaskNotFoundException
1260 1260
      */
1261
-    public function mask($mask = null){
1261
+    public function mask($mask = null) {
1262 1262
         $mask = $mask !== null ? $mask : $this->mask;
1263
-        if(class_exists($mask)){
1263
+        if (class_exists($mask)) {
1264 1264
             return new $mask($this);
1265 1265
         }
1266 1266
 
@@ -1273,7 +1273,7 @@  discard block
 block discarded – undo
1273 1273
      *
1274 1274
      * @return $this
1275 1275
      */
1276
-    public function setFolderPath($folder_path){
1276
+    public function setFolderPath($folder_path) {
1277 1277
         $this->folder_path = $folder_path;
1278 1278
 
1279 1279
         return $this;
@@ -1285,7 +1285,7 @@  discard block
 block discarded – undo
1285 1285
      *
1286 1286
      * @return $this
1287 1287
      */
1288
-    public function setConfig($config){
1288
+    public function setConfig($config) {
1289 1289
         $this->config = $config;
1290 1290
 
1291 1291
         return $this;
@@ -1297,7 +1297,7 @@  discard block
 block discarded – undo
1297 1297
      *
1298 1298
      * @return $this
1299 1299
      */
1300
-    public function setAvailableFlags($available_flags){
1300
+    public function setAvailableFlags($available_flags) {
1301 1301
         $this->available_flags = $available_flags;
1302 1302
 
1303 1303
         return $this;
@@ -1309,7 +1309,7 @@  discard block
 block discarded – undo
1309 1309
      *
1310 1310
      * @return $this
1311 1311
      */
1312
-    public function setAttachments($attachments){
1312
+    public function setAttachments($attachments) {
1313 1313
         $this->attachments = $attachments;
1314 1314
 
1315 1315
         return $this;
@@ -1321,7 +1321,7 @@  discard block
 block discarded – undo
1321 1321
      *
1322 1322
      * @return $this
1323 1323
      */
1324
-    public function setFlags($flags){
1324
+    public function setFlags($flags) {
1325 1325
         $this->flags = $flags;
1326 1326
 
1327 1327
         return $this;
@@ -1335,7 +1335,7 @@  discard block
 block discarded – undo
1335 1335
      * @throws Exceptions\RuntimeException
1336 1336
      * @throws Exceptions\ConnectionFailedException
1337 1337
      */
1338
-    public function setClient($client){
1338
+    public function setClient($client) {
1339 1339
         $this->client = $client;
1340 1340
         $this->client->openFolder($this->folder_path);
1341 1341
 
@@ -1350,7 +1350,7 @@  discard block
 block discarded – undo
1350 1350
      * @throws Exceptions\RuntimeException
1351 1351
      * @return $this
1352 1352
      */
1353
-    public function setUid($uid){
1353
+    public function setUid($uid) {
1354 1354
         $this->uid = $uid;
1355 1355
         $this->msgn = $this->client->getConnection()->getMessageNumber($this->uid);
1356 1356
         $this->msglist = null;
@@ -1367,7 +1367,7 @@  discard block
 block discarded – undo
1367 1367
      * @throws Exceptions\RuntimeException
1368 1368
      * @return $this
1369 1369
      */
1370
-    public function setMsgn($msgn, $msglist = null){
1370
+    public function setMsgn($msgn, $msglist = null) {
1371 1371
         $this->msgn = $msgn;
1372 1372
         $this->msglist = $msglist;
1373 1373
         $this->uid = $this->client->getConnection()->getUid($this->msgn);
@@ -1380,7 +1380,7 @@  discard block
 block discarded – undo
1380 1380
      *
1381 1381
      * @return int
1382 1382
      */
1383
-    public function getSequence(){
1383
+    public function getSequence() {
1384 1384
         return $this->sequence;
1385 1385
     }
1386 1386
 
@@ -1389,7 +1389,7 @@  discard block
 block discarded – undo
1389 1389
      *
1390 1390
      * @return int
1391 1391
      */
1392
-    public function getSequenceId(){
1392
+    public function getSequenceId() {
1393 1393
         return $this->sequence === IMAP::ST_UID ? $this->uid : $this->msgn;
1394 1394
     }
1395 1395
 
@@ -1401,11 +1401,11 @@  discard block
 block discarded – undo
1401 1401
      * @throws Exceptions\ConnectionFailedException
1402 1402
      * @throws Exceptions\RuntimeException
1403 1403
      */
1404
-    public function setSequenceId($uid, $msglist = null){
1404
+    public function setSequenceId($uid, $msglist = null) {
1405 1405
         if ($this->getSequence() === IMAP::ST_UID) {
1406 1406
             $this->setUid($uid);
1407 1407
             $this->setMsglist($msglist);
1408
-        }else{
1408
+        }else {
1409 1409
             $this->setMsgn($uid, $msglist);
1410 1410
         }
1411 1411
     }
Please login to merge, or discard this 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 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
      * @throws MessageContentFetchingException
78 78
      * @throws InvalidMessageDateException
79 79
      */
80
-    protected function parse(){
80
+    protected function parse() {
81 81
         $this->findContentType();
82 82
         $this->parts = $this->find_parts();
83 83
     }
@@ -85,13 +85,13 @@  discard block
 block discarded – undo
85 85
     /**
86 86
      * Determine the message content type
87 87
      */
88
-    public function findContentType(){
88
+    public function findContentType() {
89 89
 
90 90
         $content_type = $this->header->get("content_type");
91 91
         $content_type = (is_array($content_type)) ? implode(' ', $content_type) : $content_type;
92
-        if(stripos($content_type, 'multipart') === 0) {
92
+        if (stripos($content_type, 'multipart') === 0) {
93 93
             $this->type = IMAP::MESSAGE_TYPE_MULTIPART;
94
-        }else{
94
+        }else {
95 95
             $this->type = IMAP::MESSAGE_TYPE_TEXT;
96 96
         }
97 97
     }
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
      *
102 102
      * @return string|null
103 103
      */
104
-    public function getBoundary(){
104
+    public function getBoundary() {
105 105
         $boundary = $this->header->find("/boundary\=(.*)/i");
106 106
 
107 107
         if ($boundary === null) {
@@ -128,9 +128,9 @@  discard block
 block discarded – undo
128 128
      * @throws MessageContentFetchingException
129 129
      * @throws InvalidMessageDateException
130 130
      */
131
-    public function find_parts(){
132
-        if($this->type === IMAP::MESSAGE_TYPE_MULTIPART) {
133
-            if (($boundary = $this->getBoundary()) === null)  {
131
+    public function find_parts() {
132
+        if ($this->type === IMAP::MESSAGE_TYPE_MULTIPART) {
133
+            if (($boundary = $this->getBoundary()) === null) {
134 134
                 throw new MessageContentFetchingException("no content found", 0);
135 135
             }
136 136
 
@@ -139,21 +139,21 @@  discard block
 block discarded – undo
139 139
             ];
140 140
 
141 141
             if (preg_match("/boundary\=\"?(.*)\"?/", $this->raw, $match) == 1) {
142
-                if(is_array($match[1])){
143
-                    foreach($match[1] as $matched){
142
+                if (is_array($match[1])) {
143
+                    foreach ($match[1] as $matched) {
144 144
                         $boundaries[] = $this->clearBoundaryString($matched);
145 145
                     }
146
-                }else{
147
-                    if(!empty($match[1])) {
146
+                }else {
147
+                    if (!empty($match[1])) {
148 148
                         $boundaries[] = $this->clearBoundaryString($match[1]);
149 149
                     }
150 150
                 }
151 151
             }
152 152
 
153
-            $raw_parts = explode( $boundaries[0], str_replace($boundaries, $boundaries[0], $this->raw) );
153
+            $raw_parts = explode($boundaries[0], str_replace($boundaries, $boundaries[0], $this->raw));
154 154
             $parts = [];
155 155
             $part_number = 0;
156
-            foreach($raw_parts as $part) {
156
+            foreach ($raw_parts as $part) {
157 157
                 $part = trim(rtrim($part));
158 158
                 if ($part !== "--") {
159 159
                     $parts[] = new Part($part, null, $part_number);
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
         $content_type = (is_array($content_type)) ? implode(' ', $content_type) : $content_type;
92 92
         if(stripos($content_type, 'multipart') === 0) {
93 93
             $this->type = IMAP::MESSAGE_TYPE_MULTIPART;
94
-        }else{
94
+        } else{
95 95
             $this->type = IMAP::MESSAGE_TYPE_TEXT;
96 96
         }
97 97
     }
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
                     foreach($match[1] as $matched){
144 144
                         $boundaries[] = $this->clearBoundaryString($matched);
145 145
                     }
146
-                }else{
146
+                } else{
147 147
                     if(!empty($match[1])) {
148 148
                         $boundaries[] = $this->clearBoundaryString($match[1]);
149 149
                     }
Please login to merge, or discard this patch.
src/Part.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -159,10 +159,10 @@  discard block
 block discarded – undo
159 159
      *
160 160
      * @throws InvalidMessageDateException
161 161
      */
162
-    protected function parse(){
162
+    protected function parse() {
163 163
         if ($this->header === null) {
164 164
             $body = $this->findHeaders();
165
-        }else{
165
+        }else {
166 166
             $body = $this->raw;
167 167
         }
168 168
 
@@ -174,11 +174,11 @@  discard block
 block discarded – undo
174 174
         $this->name = $this->header->get("name");
175 175
         $this->filename = $this->header->get("filename");
176 176
 
177
-        if(!empty($this->header->get("id"))) {
177
+        if (!empty($this->header->get("id"))) {
178 178
             $this->id = $this->header->get("id");
179
-        } else if(!empty($this->header->get("x_attachment_id"))){
179
+        }else if (!empty($this->header->get("x_attachment_id"))) {
180 180
             $this->id = $this->header->get("x_attachment_id");
181
-        } else if(!empty($this->header->get("content_id"))){
181
+        }else if (!empty($this->header->get("content_id"))) {
182 182
             $this->id = strtr($this->header->get("content_id"), [
183 183
                 '<' => '',
184 184
                 '>' => ''
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
         }
187 187
 
188 188
         $content_types = $this->header->get("content_type");
189
-        if(!empty($content_types)){
189
+        if (!empty($content_types)) {
190 190
             $this->subtype = $this->parseSubtype($content_types);
191 191
             $content_type = $content_types;
192 192
             if (is_array($content_types)) {
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
      * @return string
208 208
      * @throws InvalidMessageDateException
209 209
      */
210
-    private function findHeaders(){
210
+    private function findHeaders() {
211 211
         $body = $this->raw;
212 212
         while (($pos = strpos($body, "\r\n")) > 0) {
213 213
             $body = substr($body, $pos + 2);
@@ -226,16 +226,16 @@  discard block
 block discarded – undo
226 226
      *
227 227
      * @return string
228 228
      */
229
-    private function parseSubtype($content_type){
229
+    private function parseSubtype($content_type) {
230 230
         if (is_array($content_type)) {
231
-            foreach ($content_type as $part){
232
-                if ((strpos($part, "/")) !== false){
231
+            foreach ($content_type as $part) {
232
+                if ((strpos($part, "/")) !== false) {
233 233
                     return $this->parseSubtype($part);
234 234
                 }
235 235
             }
236 236
             return null;
237 237
         }
238
-        if (($pos = strpos($content_type, "/")) !== false){
238
+        if (($pos = strpos($content_type, "/")) !== false) {
239 239
             return substr($content_type, $pos + 1);
240 240
         }
241 241
         return null;
@@ -244,9 +244,9 @@  discard block
 block discarded – undo
244 244
     /**
245 245
      * Try to parse the disposition if any is present
246 246
      */
247
-    private function parseDisposition(){
247
+    private function parseDisposition() {
248 248
         $content_disposition = $this->header->get("content_disposition");
249
-        if($content_disposition !== null) {
249
+        if ($content_disposition !== null) {
250 250
             $this->ifdisposition = true;
251 251
             $this->disposition = (is_array($content_disposition)) ? implode(' ', $content_disposition) : $content_disposition;
252 252
         }
@@ -255,9 +255,9 @@  discard block
 block discarded – undo
255 255
     /**
256 256
      * Try to parse the description if any is present
257 257
      */
258
-    private function parseDescription(){
258
+    private function parseDescription() {
259 259
         $content_description = $this->header->get("content_description");
260
-        if($content_description !== null) {
260
+        if ($content_description !== null) {
261 261
             $this->ifdescription = true;
262 262
             $this->description = $content_description;
263 263
         }
@@ -266,9 +266,9 @@  discard block
 block discarded – undo
266 266
     /**
267 267
      * Try to parse the encoding if any is present
268 268
      */
269
-    private function parseEncoding(){
269
+    private function parseEncoding() {
270 270
         $encoding = $this->header->get("content_transfer_encoding");
271
-        if($encoding !== null) {
271
+        if ($encoding !== null) {
272 272
             switch (strtolower($encoding)) {
273 273
                 case "quoted-printable":
274 274
                     $this->encoding = IMAP::MESSAGE_ENC_QUOTED_PRINTABLE;
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
      *
299 299
      * @return bool
300 300
      */
301
-    public function isAttachment(){
301
+    public function isAttachment() {
302 302
         $valid_disposition = in_array(strtolower($this->disposition), ClientManager::get('options.dispositions'));
303 303
 
304 304
         if ($this->type == IMAP::MESSAGE_TYPE_TEXT && ($this->ifdisposition == 0 || (empty($this->disposition))) && !$valid_disposition) {
Please login to merge, or discard this patch.