@@ -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); |
@@ -435,9 +435,9 @@ discard block |
||
435 | 435 | */ |
436 | 436 | private function fetchPart(Part $part) { |
437 | 437 | |
438 | - if ($part->type == IMAP::MESSAGE_TYPE_TEXT && ($part->ifdisposition == 0 || (empty($part->disposition) || !in_array(strtolower($part->disposition), ['attachment', 'inline'])) ) ) { |
|
438 | + if ($part->type == IMAP::MESSAGE_TYPE_TEXT && ($part->ifdisposition == 0 || (empty($part->disposition) || !in_array(strtolower($part->disposition), ['attachment', 'inline'])))) { |
|
439 | 439 | |
440 | - if ( in_array(($subtype = strtolower($part->subtype)), ["plain", "csv", "html"]) && $part->filename == null && $part->name == null) { |
|
440 | + if (in_array(($subtype = strtolower($part->subtype)), ["plain", "csv", "html"]) && $part->filename == null && $part->name == null) { |
|
441 | 441 | $encoding = $this->getEncoding($part); |
442 | 442 | |
443 | 443 | $content = $this->decodeString($part->content, $part->encoding); |
@@ -458,10 +458,10 @@ discard block |
||
458 | 458 | } |
459 | 459 | |
460 | 460 | $this->bodies[$subtype == "plain" ? "text" : $subtype] = $content; |
461 | - } else { |
|
461 | + }else { |
|
462 | 462 | $this->fetchAttachment($part); |
463 | 463 | } |
464 | - } else { |
|
464 | + }else { |
|
465 | 465 | $this->fetchAttachment($part); |
466 | 466 | } |
467 | 467 | } |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | if ($oAttachment->getName() !== null) { |
478 | 478 | if ($oAttachment->getId() !== null) { |
479 | 479 | $this->attachments->put($oAttachment->getId(), $oAttachment); |
480 | - } else { |
|
480 | + }else { |
|
481 | 481 | $this->attachments->push($oAttachment); |
482 | 482 | } |
483 | 483 | } |
@@ -594,7 +594,7 @@ discard block |
||
594 | 594 | |
595 | 595 | if (function_exists('iconv') && $from != 'UTF-7' && $to != 'UTF-7') { |
596 | 596 | return @iconv($from, $to.'//IGNORE', $str); |
597 | - } else { |
|
597 | + }else { |
|
598 | 598 | if (!$from) { |
599 | 599 | return mb_convert_encoding($str, $to); |
600 | 600 | } |
@@ -615,9 +615,9 @@ discard block |
||
615 | 615 | return EncodingAliases::get($parameter->value); |
616 | 616 | } |
617 | 617 | } |
618 | - }elseif (property_exists($structure, 'charset')){ |
|
618 | + }elseif (property_exists($structure, 'charset')) { |
|
619 | 619 | return EncodingAliases::get($structure->charset); |
620 | - }elseif (is_string($structure) === true){ |
|
620 | + }elseif (is_string($structure) === true) { |
|
621 | 621 | return mb_detect_encoding($structure); |
622 | 622 | } |
623 | 623 | |
@@ -631,7 +631,7 @@ discard block |
||
631 | 631 | * @throws Exceptions\ConnectionFailedException |
632 | 632 | * @throws Exceptions\FolderFetchingException |
633 | 633 | */ |
634 | - public function getFolder(){ |
|
634 | + public function getFolder() { |
|
635 | 635 | return $this->client->getFolder($this->folder_path); |
636 | 636 | } |
637 | 637 | |
@@ -646,13 +646,13 @@ discard block |
||
646 | 646 | * @throws Exceptions\FolderFetchingException |
647 | 647 | * @throws Exceptions\GetMessagesFailedException |
648 | 648 | */ |
649 | - public function thread($sent_folder = null, &$thread = null, $folder = null){ |
|
649 | + public function thread($sent_folder = null, &$thread = null, $folder = null) { |
|
650 | 650 | $thread = $thread ? $thread : MessageCollection::make([]); |
651 | - $folder = $folder ? $folder : $this->getFolder(); |
|
651 | + $folder = $folder ? $folder : $this->getFolder(); |
|
652 | 652 | $sent_folder = $sent_folder ? $sent_folder : $this->client->getFolder(ClientManager::get("options.common_folders.sent", "INBOX/Sent")); |
653 | 653 | |
654 | 654 | /** @var Message $message */ |
655 | - foreach($thread as $message) { |
|
655 | + foreach ($thread as $message) { |
|
656 | 656 | if ($message->message_id == $this->message_id) { |
657 | 657 | return $thread; |
658 | 658 | } |
@@ -673,7 +673,7 @@ discard block |
||
673 | 673 | }); |
674 | 674 | |
675 | 675 | if (is_array($this->in_reply_to)) { |
676 | - foreach($this->in_reply_to as $in_reply_to) { |
|
676 | + foreach ($this->in_reply_to as $in_reply_to) { |
|
677 | 677 | $folder->query()->messageId($in_reply_to) |
678 | 678 | ->setFetchBody($this->getFetchBodyOption()) |
679 | 679 | ->leaveUnread()->get()->each(function($message) use(&$thread, $folder, $sent_folder){ |
@@ -718,7 +718,7 @@ discard block |
||
718 | 718 | |
719 | 719 | $this->client->openFolder($this->folder_path); |
720 | 720 | if ($this->client->getConnection()->copyMessage($folder->path, $this->msgn) == true) { |
721 | - if($expunge) $this->client->expunge(); |
|
721 | + if ($expunge) $this->client->expunge(); |
|
722 | 722 | |
723 | 723 | $this->client->openFolder($folder->path); |
724 | 724 | $message_num = $this->client->getConnection()->getMessageNumber($next_uid); |
@@ -760,7 +760,7 @@ discard block |
||
760 | 760 | |
761 | 761 | $this->client->openFolder($this->folder_path); |
762 | 762 | if ($this->client->getConnection()->moveMessage($folder->path, $this->msgn) == true) { |
763 | - if($expunge) $this->client->expunge(); |
|
763 | + if ($expunge) $this->client->expunge(); |
|
764 | 764 | |
765 | 765 | $this->client->openFolder($folder->path); |
766 | 766 | $message_num = $this->client->getConnection()->getMessageNumber($next_uid); |
@@ -787,7 +787,7 @@ discard block |
||
787 | 787 | */ |
788 | 788 | public function delete($expunge = true) { |
789 | 789 | $status = $this->setFlag("Deleted"); |
790 | - if($expunge) $this->client->expunge(); |
|
790 | + if ($expunge) $this->client->expunge(); |
|
791 | 791 | |
792 | 792 | $event = $this->getEvent("message", "deleted"); |
793 | 793 | $event::dispatch($this); |
@@ -806,7 +806,7 @@ discard block |
||
806 | 806 | */ |
807 | 807 | public function restore($expunge = true) { |
808 | 808 | $status = $this->unsetFlag("Deleted"); |
809 | - if($expunge) $this->client->expunge(); |
|
809 | + if ($expunge) $this->client->expunge(); |
|
810 | 810 | |
811 | 811 | $event = $this->getEvent("message", "restored"); |
812 | 812 | $event::dispatch($this); |
@@ -959,7 +959,7 @@ discard block |
||
959 | 959 | * |
960 | 960 | * @return object|null |
961 | 961 | */ |
962 | - public function getStructure(){ |
|
962 | + public function getStructure() { |
|
963 | 963 | return $this->structure; |
964 | 964 | } |
965 | 965 | |
@@ -985,7 +985,7 @@ discard block |
||
985 | 985 | * |
986 | 986 | * @return array |
987 | 987 | */ |
988 | - public function getAttributes(){ |
|
988 | + public function getAttributes() { |
|
989 | 989 | return array_merge($this->attributes, $this->header->getAttributes()); |
990 | 990 | } |
991 | 991 | |
@@ -995,8 +995,8 @@ discard block |
||
995 | 995 | * |
996 | 996 | * @return $this |
997 | 997 | */ |
998 | - public function setMask($mask){ |
|
999 | - if(class_exists($mask)){ |
|
998 | + public function setMask($mask) { |
|
999 | + if (class_exists($mask)) { |
|
1000 | 1000 | $this->mask = $mask; |
1001 | 1001 | } |
1002 | 1002 | |
@@ -1008,7 +1008,7 @@ discard block |
||
1008 | 1008 | * |
1009 | 1009 | * @return string |
1010 | 1010 | */ |
1011 | - public function getMask(){ |
|
1011 | + public function getMask() { |
|
1012 | 1012 | return $this->mask; |
1013 | 1013 | } |
1014 | 1014 | |
@@ -1019,9 +1019,9 @@ discard block |
||
1019 | 1019 | * @return mixed |
1020 | 1020 | * @throws MaskNotFoundException |
1021 | 1021 | */ |
1022 | - public function mask($mask = null){ |
|
1022 | + public function mask($mask = null) { |
|
1023 | 1023 | $mask = $mask !== null ? $mask : $this->mask; |
1024 | - if(class_exists($mask)){ |
|
1024 | + if (class_exists($mask)) { |
|
1025 | 1025 | return new $mask($this); |
1026 | 1026 | } |
1027 | 1027 |