@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | public function __construct($msgn, $msglist, Client $client, $fetch_options = null, $fetch_body = false, $fetch_flags = false) { |
197 | 197 | |
198 | 198 | $default_mask = $client->getDefaultMessageMask(); |
199 | - if($default_mask != null) { |
|
199 | + if ($default_mask != null) { |
|
200 | 200 | $this->mask = $default_mask; |
201 | 201 | } |
202 | 202 | $this->events["message"] = $client->getDefaultEvents("message"); |
@@ -241,13 +241,13 @@ discard block |
||
241 | 241 | * @throws MethodNotFoundException |
242 | 242 | */ |
243 | 243 | public function __call($method, $arguments) { |
244 | - if(strtolower(substr($method, 0, 3)) === 'get') { |
|
244 | + if (strtolower(substr($method, 0, 3)) === 'get') { |
|
245 | 245 | $name = Str::snake(substr($method, 3)); |
246 | 246 | return $this->get($name); |
247 | 247 | }elseif (strtolower(substr($method, 0, 3)) === 'set') { |
248 | 248 | $name = Str::snake(substr($method, 3)); |
249 | 249 | |
250 | - if(in_array($name, array_keys($this->attributes))) { |
|
250 | + if (in_array($name, array_keys($this->attributes))) { |
|
251 | 251 | $this->attributes[$name] = array_pop($arguments); |
252 | 252 | |
253 | 253 | return $this->attributes[$name]; |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | * @return mixed|null |
289 | 289 | */ |
290 | 290 | public function get($name) { |
291 | - if(isset($this->attributes[$name])) { |
|
291 | + if (isset($this->attributes[$name])) { |
|
292 | 292 | return $this->attributes[$name]; |
293 | 293 | } |
294 | 294 | |
@@ -370,8 +370,8 @@ discard block |
||
370 | 370 | $flags = $this->client->getConnection()->flags([$this->msgn]); |
371 | 371 | |
372 | 372 | if (isset($flags[$this->msgn])) { |
373 | - foreach($flags[$this->msgn] as $flag) { |
|
374 | - if (strpos($flag, "\\") === 0){ |
|
373 | + foreach ($flags[$this->msgn] as $flag) { |
|
374 | + if (strpos($flag, "\\") === 0) { |
|
375 | 375 | $flag = substr($flag, 1); |
376 | 376 | } |
377 | 377 | $flag_key = strtolower($flag); |
@@ -440,7 +440,7 @@ discard block |
||
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); |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | if ($oAttachment->getName() !== null && $oAttachment->getSize() > 0) { |
479 | 479 | if ($oAttachment->getId() !== null) { |
480 | 480 | $this->attachments->put($oAttachment->getId(), $oAttachment); |
481 | - } else { |
|
481 | + }else { |
|
482 | 482 | $this->attachments->push($oAttachment); |
483 | 483 | } |
484 | 484 | } |
@@ -595,7 +595,7 @@ discard block |
||
595 | 595 | |
596 | 596 | if (function_exists('iconv') && $from != 'UTF-7' && $to != 'UTF-7') { |
597 | 597 | return @iconv($from, $to.'//IGNORE', $str); |
598 | - } else { |
|
598 | + }else { |
|
599 | 599 | if (!$from) { |
600 | 600 | return mb_convert_encoding($str, $to); |
601 | 601 | } |
@@ -616,9 +616,9 @@ discard block |
||
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 | |
@@ -632,7 +632,7 @@ discard block |
||
632 | 632 | * @throws Exceptions\ConnectionFailedException |
633 | 633 | * @throws Exceptions\FolderFetchingException |
634 | 634 | */ |
635 | - public function getFolder(){ |
|
635 | + public function getFolder() { |
|
636 | 636 | return $this->client->getFolder($this->folder_path); |
637 | 637 | } |
638 | 638 | |
@@ -647,13 +647,13 @@ discard block |
||
647 | 647 | * @throws Exceptions\FolderFetchingException |
648 | 648 | * @throws Exceptions\GetMessagesFailedException |
649 | 649 | */ |
650 | - public function thread($sent_folder = null, &$thread = null, $folder = null){ |
|
650 | + public function thread($sent_folder = null, &$thread = null, $folder = null) { |
|
651 | 651 | $thread = $thread ? $thread : MessageCollection::make([]); |
652 | - $folder = $folder ? $folder : $this->getFolder(); |
|
652 | + $folder = $folder ? $folder : $this->getFolder(); |
|
653 | 653 | $sent_folder = $sent_folder ? $sent_folder : $this->client->getFolder(ClientManager::get("options.common_folders.sent", "INBOX/Sent")); |
654 | 654 | |
655 | 655 | /** @var Message $message */ |
656 | - foreach($thread as $message) { |
|
656 | + foreach ($thread as $message) { |
|
657 | 657 | if ($message->message_id == $this->message_id) { |
658 | 658 | return $thread; |
659 | 659 | } |
@@ -674,7 +674,7 @@ discard block |
||
674 | 674 | }); |
675 | 675 | |
676 | 676 | if (is_array($this->in_reply_to)) { |
677 | - foreach($this->in_reply_to as $in_reply_to) { |
|
677 | + foreach ($this->in_reply_to as $in_reply_to) { |
|
678 | 678 | $folder->query()->messageId($in_reply_to) |
679 | 679 | ->setFetchBody($this->getFetchBodyOption()) |
680 | 680 | ->leaveUnread()->get()->each(function($message) use(&$thread, $folder, $sent_folder){ |
@@ -719,7 +719,7 @@ discard block |
||
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) $this->client->expunge(); |
|
723 | 723 | |
724 | 724 | $this->client->openFolder($folder->path); |
725 | 725 | $message_num = $this->client->getConnection()->getMessageNumber($next_uid); |
@@ -761,7 +761,7 @@ discard block |
||
761 | 761 | |
762 | 762 | $this->client->openFolder($this->folder_path); |
763 | 763 | if ($this->client->getConnection()->moveMessage($folder->path, $this->msgn) == true) { |
764 | - if($expunge) $this->client->expunge(); |
|
764 | + if ($expunge) $this->client->expunge(); |
|
765 | 765 | |
766 | 766 | $this->client->openFolder($folder->path); |
767 | 767 | $message_num = $this->client->getConnection()->getMessageNumber($next_uid); |
@@ -788,7 +788,7 @@ discard block |
||
788 | 788 | */ |
789 | 789 | public function delete($expunge = true) { |
790 | 790 | $status = $this->setFlag("Deleted"); |
791 | - if($expunge) $this->client->expunge(); |
|
791 | + if ($expunge) $this->client->expunge(); |
|
792 | 792 | |
793 | 793 | $event = $this->getEvent("message", "deleted"); |
794 | 794 | $event::dispatch($this); |
@@ -807,7 +807,7 @@ discard block |
||
807 | 807 | */ |
808 | 808 | public function restore($expunge = true) { |
809 | 809 | $status = $this->unsetFlag("Deleted"); |
810 | - if($expunge) $this->client->expunge(); |
|
810 | + if ($expunge) $this->client->expunge(); |
|
811 | 811 | |
812 | 812 | $event = $this->getEvent("message", "restored"); |
813 | 813 | $event::dispatch($this); |
@@ -960,7 +960,7 @@ discard block |
||
960 | 960 | * |
961 | 961 | * @return object|null |
962 | 962 | */ |
963 | - public function getStructure(){ |
|
963 | + public function getStructure() { |
|
964 | 964 | return $this->structure; |
965 | 965 | } |
966 | 966 | |
@@ -986,7 +986,7 @@ discard block |
||
986 | 986 | * |
987 | 987 | * @return array |
988 | 988 | */ |
989 | - public function getAttributes(){ |
|
989 | + public function getAttributes() { |
|
990 | 990 | return array_merge($this->attributes, $this->header->getAttributes()); |
991 | 991 | } |
992 | 992 | |
@@ -996,8 +996,8 @@ discard block |
||
996 | 996 | * |
997 | 997 | * @return $this |
998 | 998 | */ |
999 | - public function setMask($mask){ |
|
1000 | - if(class_exists($mask)){ |
|
999 | + public function setMask($mask) { |
|
1000 | + if (class_exists($mask)) { |
|
1001 | 1001 | $this->mask = $mask; |
1002 | 1002 | } |
1003 | 1003 | |
@@ -1009,7 +1009,7 @@ discard block |
||
1009 | 1009 | * |
1010 | 1010 | * @return string |
1011 | 1011 | */ |
1012 | - public function getMask(){ |
|
1012 | + public function getMask() { |
|
1013 | 1013 | return $this->mask; |
1014 | 1014 | } |
1015 | 1015 | |
@@ -1020,9 +1020,9 @@ discard block |
||
1020 | 1020 | * @return mixed |
1021 | 1021 | * @throws MaskNotFoundException |
1022 | 1022 | */ |
1023 | - public function mask($mask = null){ |
|
1023 | + public function mask($mask = null) { |
|
1024 | 1024 | $mask = $mask !== null ? $mask : $this->mask; |
1025 | - if(class_exists($mask)){ |
|
1025 | + if (class_exists($mask)) { |
|
1026 | 1026 | return new $mask($this); |
1027 | 1027 | } |
1028 | 1028 |