@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | * |
61 | 61 | * @return string |
62 | 62 | */ |
63 | - public function toString(){ |
|
63 | + public function toString() { |
|
64 | 64 | return $this->__toString(); |
65 | 65 | } |
66 | 66 | |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | * |
70 | 70 | * @return array |
71 | 71 | */ |
72 | - public function __serialize(){ |
|
72 | + public function __serialize() { |
|
73 | 73 | return $this->values; |
74 | 74 | } |
75 | 75 | |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | * |
79 | 79 | * @return array |
80 | 80 | */ |
81 | - public function toArray(){ |
|
81 | + public function toArray() { |
|
82 | 82 | return $this->__serialize(); |
83 | 83 | } |
84 | 84 | |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | if ($this->contains($value) === false) { |
142 | 142 | $this->values[] = $value; |
143 | 143 | } |
144 | - }else{ |
|
144 | + }else { |
|
145 | 145 | $this->values[] = $value; |
146 | 146 | } |
147 | 147 | } |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | * |
153 | 153 | * @return Attribute |
154 | 154 | */ |
155 | - public function setName($name){ |
|
155 | + public function setName($name) { |
|
156 | 156 | $this->name = $name; |
157 | 157 | |
158 | 158 | return $this; |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | * |
164 | 164 | * @return string |
165 | 165 | */ |
166 | - public function getName(){ |
|
166 | + public function getName() { |
|
167 | 167 | return $this->name; |
168 | 168 | } |
169 | 169 | |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | * |
173 | 173 | * @return array |
174 | 174 | */ |
175 | - public function get(){ |
|
175 | + public function get() { |
|
176 | 176 | return $this->values; |
177 | 177 | } |
178 | 178 | |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | * |
182 | 182 | * @return array |
183 | 183 | */ |
184 | - public function all(){ |
|
184 | + public function all() { |
|
185 | 185 | return $this->get(); |
186 | 186 | } |
187 | 187 | |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | * |
191 | 191 | * @return mixed|null |
192 | 192 | */ |
193 | - public function first(){ |
|
193 | + public function first() { |
|
194 | 194 | if (count($this->values) > 0) { |
195 | 195 | return $this->values[0]; |
196 | 196 | } |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | * |
203 | 203 | * @return mixed|null |
204 | 204 | */ |
205 | - public function last(){ |
|
205 | + public function last() { |
|
206 | 206 | $cnt = count($this->values); |
207 | 207 | if ($cnt > 0) { |
208 | 208 | return $this->values[$cnt - 1]; |
@@ -80,11 +80,11 @@ discard block |
||
80 | 80 | $this->setClient($client); |
81 | 81 | |
82 | 82 | $this->sequence = ClientManager::get('options.sequence', IMAP::ST_MSGN); |
83 | - if(ClientManager::get('options.fetch') === IMAP::FT_PEEK) $this->leaveUnread(); |
|
83 | + if (ClientManager::get('options.fetch') === IMAP::FT_PEEK) $this->leaveUnread(); |
|
84 | 84 | |
85 | 85 | if (ClientManager::get('options.fetch_order') === 'desc') { |
86 | 86 | $this->fetch_order = 'desc'; |
87 | - } else { |
|
87 | + }else { |
|
88 | 88 | $this->fetch_order = 'asc'; |
89 | 89 | } |
90 | 90 | |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | /** |
99 | 99 | * Instance boot method for additional functionality |
100 | 100 | */ |
101 | - protected function boot(){} |
|
101 | + protected function boot() {} |
|
102 | 102 | |
103 | 103 | /** |
104 | 104 | * Parse a given value |
@@ -106,8 +106,8 @@ discard block |
||
106 | 106 | * |
107 | 107 | * @return string |
108 | 108 | */ |
109 | - protected function parse_value($value){ |
|
110 | - switch(true){ |
|
109 | + protected function parse_value($value) { |
|
110 | + switch (true) { |
|
111 | 111 | case $value instanceof \Carbon\Carbon: |
112 | 112 | $value = $value->format($this->date_format); |
113 | 113 | break; |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | * @throws MessageSearchValidationException |
125 | 125 | */ |
126 | 126 | protected function parse_date($date) { |
127 | - if($date instanceof \Carbon\Carbon) return $date; |
|
127 | + if ($date instanceof \Carbon\Carbon) return $date; |
|
128 | 128 | |
129 | 129 | try { |
130 | 130 | $date = Carbon::parse($date); |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | * @return Collection |
176 | 176 | * @throws GetMessagesFailedException |
177 | 177 | */ |
178 | - protected function search(){ |
|
178 | + protected function search() { |
|
179 | 179 | $this->generate_query(); |
180 | 180 | |
181 | 181 | try { |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | $raw_flag = isset($raw_flags[$uid]) ? $raw_flags[$uid] : []; |
241 | 241 | |
242 | 242 | $message = Message::make($uid, $msglist, $this->getClient(), $raw_header, $raw_content, $raw_flag, $this->getFetchOptions(), $this->sequence); |
243 | - switch ($message_key){ |
|
243 | + switch ($message_key) { |
|
244 | 244 | case 'number': |
245 | 245 | $message_key = $message->getMessageNo(); |
246 | 246 | break; |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | |
263 | 263 | return $messages; |
264 | 264 | } catch (\Exception $e) { |
265 | - throw new GetMessagesFailedException($e->getMessage(),0, $e); |
|
265 | + throw new GetMessagesFailedException($e->getMessage(), 0, $e); |
|
266 | 266 | } |
267 | 267 | } |
268 | 268 | |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | * @throws \Webklex\PHPIMAP\Exceptions\EventNotFoundException |
282 | 282 | * @throws \Webklex\PHPIMAP\Exceptions\MessageFlagException |
283 | 283 | */ |
284 | - public function getMessage($uid, $msglist = null, $sequence = null){ |
|
284 | + public function getMessage($uid, $msglist = null, $sequence = null) { |
|
285 | 285 | return new Message($uid, $msglist, $this->getClient(), $this->getFetchOptions(), $this->getFetchBody(), $this->getFetchFlags(), $sequence ? $sequence : $this->sequence); |
286 | 286 | } |
287 | 287 | |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | * @throws \Webklex\PHPIMAP\Exceptions\EventNotFoundException |
300 | 300 | * @throws \Webklex\PHPIMAP\Exceptions\MessageFlagException |
301 | 301 | */ |
302 | - public function getMessageByMsgn($msgn, $msglist = null){ |
|
302 | + public function getMessageByMsgn($msgn, $msglist = null) { |
|
303 | 303 | return $this->getMessage($msgn, $msglist, IMAP::ST_MSGN); |
304 | 304 | } |
305 | 305 | |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | * @throws \Webklex\PHPIMAP\Exceptions\EventNotFoundException |
317 | 317 | * @throws \Webklex\PHPIMAP\Exceptions\MessageFlagException |
318 | 318 | */ |
319 | - public function getMessageByUid($uid){ |
|
319 | + public function getMessageByUid($uid) { |
|
320 | 320 | return $this->getMessage($uid, null, IMAP::ST_UID); |
321 | 321 | } |
322 | 322 | |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | * @return LengthAwarePaginator |
330 | 330 | * @throws GetMessagesFailedException |
331 | 331 | */ |
332 | - public function paginate($per_page = 5, $page = null, $page_name = 'imap_page'){ |
|
332 | + public function paginate($per_page = 5, $page = null, $page_name = 'imap_page') { |
|
333 | 333 | if ( |
334 | 334 | $page === null |
335 | 335 | && isset($_GET[$page_name]) |
@@ -355,10 +355,10 @@ discard block |
||
355 | 355 | $this->query->each(function($statement) use(&$query) { |
356 | 356 | if (count($statement) == 1) { |
357 | 357 | $query .= $statement[0]; |
358 | - } else { |
|
359 | - if($statement[1] === null){ |
|
358 | + }else { |
|
359 | + if ($statement[1] === null) { |
|
360 | 360 | $query .= $statement[0]; |
361 | - }else{ |
|
361 | + }else { |
|
362 | 362 | $query .= $statement[0].' "'.$statement[1].'"'; |
363 | 363 | } |
364 | 364 | } |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | * @return $this |
389 | 389 | */ |
390 | 390 | public function limit($limit, $page = 1) { |
391 | - if($page >= 1) $this->page = $page; |
|
391 | + if ($page >= 1) $this->page = $page; |
|
392 | 392 | $this->limit = $limit; |
393 | 393 | |
394 | 394 | return $this; |
@@ -202,7 +202,7 @@ discard block |
||
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"); |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | if ($this->sequence === IMAP::ST_UID) { |
228 | 228 | $this->uid = $uid; |
229 | 229 | $this->msgn = $this->client->getConnection()->getMessageNumber($this->uid); |
230 | - }else{ |
|
230 | + }else { |
|
231 | 231 | $this->msgn = $uid; |
232 | 232 | $this->uid = $this->client->getConnection()->getUid($this->msgn); |
233 | 233 | } |
@@ -268,13 +268,13 @@ discard block |
||
268 | 268 | * @throws MessageFlagException |
269 | 269 | * @throws Exceptions\RuntimeException |
270 | 270 | */ |
271 | - public static function make($uid, $msglist, Client $client, $raw_header, $raw_body, $raw_flags, $fetch_options = null, $sequence = null){ |
|
271 | + public static function make($uid, $msglist, Client $client, $raw_header, $raw_body, $raw_flags, $fetch_options = null, $sequence = null) { |
|
272 | 272 | $reflection = new \ReflectionClass(self::class); |
273 | 273 | /** @var self $instance */ |
274 | 274 | $instance = $reflection->newInstanceWithoutConstructor(); |
275 | 275 | |
276 | 276 | $default_mask = $client->getDefaultMessageMask(); |
277 | - if($default_mask != null) { |
|
277 | + if ($default_mask != null) { |
|
278 | 278 | $instance->setMask($default_mask); |
279 | 279 | } |
280 | 280 | $instance->setEvents([ |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | if ($instance->getSequence() === IMAP::ST_UID) { |
295 | 295 | $instance->setUid($uid); |
296 | 296 | $instance->setMsglist($msglist); |
297 | - }else{ |
|
297 | + }else { |
|
298 | 298 | $instance->setMsgn($uid, $msglist); |
299 | 299 | } |
300 | 300 | |
@@ -315,13 +315,13 @@ discard block |
||
315 | 315 | * @throws MethodNotFoundException |
316 | 316 | */ |
317 | 317 | public function __call($method, $arguments) { |
318 | - if(strtolower(substr($method, 0, 3)) === 'get') { |
|
318 | + if (strtolower(substr($method, 0, 3)) === 'get') { |
|
319 | 319 | $name = Str::snake(substr($method, 3)); |
320 | 320 | return $this->get($name); |
321 | 321 | }elseif (strtolower(substr($method, 0, 3)) === 'set') { |
322 | 322 | $name = Str::snake(substr($method, 3)); |
323 | 323 | |
324 | - if(in_array($name, array_keys($this->attributes))) { |
|
324 | + if (in_array($name, array_keys($this->attributes))) { |
|
325 | 325 | return $this->__set($name, array_pop($arguments)); |
326 | 326 | } |
327 | 327 | |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | * @return mixed|null |
361 | 361 | */ |
362 | 362 | public function get($name) { |
363 | - if(isset($this->attributes[$name])) { |
|
363 | + if (isset($this->attributes[$name])) { |
|
364 | 364 | return $this->attributes[$name]; |
365 | 365 | } |
366 | 366 | |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | * |
435 | 435 | * @throws InvalidMessageDateException |
436 | 436 | */ |
437 | - public function parseRawHeader($raw_header){ |
|
437 | + public function parseRawHeader($raw_header) { |
|
438 | 438 | $this->header = new Header($raw_header); |
439 | 439 | } |
440 | 440 | |
@@ -445,8 +445,8 @@ discard block |
||
445 | 445 | public function parseRawFlags($raw_flags) { |
446 | 446 | $this->flags = FlagCollection::make([]); |
447 | 447 | |
448 | - foreach($raw_flags as $flag) { |
|
449 | - if (strpos($flag, "\\") === 0){ |
|
448 | + foreach ($raw_flags as $flag) { |
|
449 | + if (strpos($flag, "\\") === 0) { |
|
450 | 450 | $flag = substr($flag, 1); |
451 | 451 | } |
452 | 452 | $flag_key = strtolower($flag); |
@@ -516,7 +516,7 @@ discard block |
||
516 | 516 | * @throws Exceptions\EventNotFoundException |
517 | 517 | * @throws MessageFlagException |
518 | 518 | */ |
519 | - public function peek(){ |
|
519 | + public function peek() { |
|
520 | 520 | if ($this->fetch_options == IMAP::FT_PEEK) { |
521 | 521 | if ($this->getFlags()->get("seen") == null) { |
522 | 522 | $this->unsetFlag("Seen"); |
@@ -563,7 +563,7 @@ discard block |
||
563 | 563 | private function fetchPart(Part $part) { |
564 | 564 | if ($part->isAttachment()) { |
565 | 565 | $this->fetchAttachment($part); |
566 | - }else{ |
|
566 | + }else { |
|
567 | 567 | $encoding = $this->getEncoding($part); |
568 | 568 | |
569 | 569 | $content = $this->decodeString($part->content, $part->encoding); |
@@ -600,7 +600,7 @@ discard block |
||
600 | 600 | if ($oAttachment->getName() !== null && $oAttachment->getSize() > 0) { |
601 | 601 | if ($oAttachment->getId() !== null) { |
602 | 602 | $this->attachments->put($oAttachment->getId(), $oAttachment); |
603 | - } else { |
|
603 | + }else { |
|
604 | 604 | $this->attachments->push($oAttachment); |
605 | 605 | } |
606 | 606 | } |
@@ -734,7 +734,7 @@ discard block |
||
734 | 734 | |
735 | 735 | if (function_exists('iconv') && $from != 'UTF-7' && $to != 'UTF-7') { |
736 | 736 | return @iconv($from, $to.'//IGNORE', $str); |
737 | - } else { |
|
737 | + }else { |
|
738 | 738 | if (!$from) { |
739 | 739 | return mb_convert_encoding($str, $to); |
740 | 740 | } |
@@ -755,9 +755,9 @@ discard block |
||
755 | 755 | return EncodingAliases::get($parameter->value); |
756 | 756 | } |
757 | 757 | } |
758 | - }elseif (property_exists($structure, 'charset')){ |
|
758 | + }elseif (property_exists($structure, 'charset')) { |
|
759 | 759 | return EncodingAliases::get($structure->charset); |
760 | - }elseif (is_string($structure) === true){ |
|
760 | + }elseif (is_string($structure) === true) { |
|
761 | 761 | return mb_detect_encoding($structure); |
762 | 762 | } |
763 | 763 | |
@@ -771,7 +771,7 @@ discard block |
||
771 | 771 | * @throws Exceptions\ConnectionFailedException |
772 | 772 | * @throws Exceptions\FolderFetchingException |
773 | 773 | */ |
774 | - public function getFolder(){ |
|
774 | + public function getFolder() { |
|
775 | 775 | return $this->client->getFolder($this->folder_path); |
776 | 776 | } |
777 | 777 | |
@@ -786,13 +786,13 @@ discard block |
||
786 | 786 | * @throws Exceptions\FolderFetchingException |
787 | 787 | * @throws Exceptions\GetMessagesFailedException |
788 | 788 | */ |
789 | - public function thread($sent_folder = null, &$thread = null, $folder = null){ |
|
789 | + public function thread($sent_folder = null, &$thread = null, $folder = null) { |
|
790 | 790 | $thread = $thread ? $thread : MessageCollection::make([]); |
791 | - $folder = $folder ? $folder : $this->getFolder(); |
|
791 | + $folder = $folder ? $folder : $this->getFolder(); |
|
792 | 792 | $sent_folder = $sent_folder ? $sent_folder : $this->client->getFolder(ClientManager::get("options.common_folders.sent", "INBOX/Sent")); |
793 | 793 | |
794 | 794 | /** @var Message $message */ |
795 | - foreach($thread as $message) { |
|
795 | + foreach ($thread as $message) { |
|
796 | 796 | if ($message->message_id == $this->message_id) { |
797 | 797 | return $thread; |
798 | 798 | } |
@@ -813,7 +813,7 @@ discard block |
||
813 | 813 | }); |
814 | 814 | |
815 | 815 | if (is_array($this->in_reply_to)) { |
816 | - foreach($this->in_reply_to as $in_reply_to) { |
|
816 | + foreach ($this->in_reply_to as $in_reply_to) { |
|
817 | 817 | $folder->query()->messageId($in_reply_to) |
818 | 818 | ->setFetchBody($this->getFetchBodyOption()) |
819 | 819 | ->leaveUnread()->get()->each(function($message) use(&$thread, $folder, $sent_folder){ |
@@ -858,13 +858,13 @@ discard block |
||
858 | 858 | |
859 | 859 | $this->client->openFolder($this->folder_path); |
860 | 860 | if ($this->client->getConnection()->copyMessage($folder->path, $this->getSequenceId(), null, $this->sequence === IMAP::ST_UID) == true) { |
861 | - if($expunge) $this->client->expunge(); |
|
861 | + if ($expunge) $this->client->expunge(); |
|
862 | 862 | |
863 | 863 | $this->client->openFolder($folder->path); |
864 | 864 | |
865 | 865 | if ($this->sequence === IMAP::ST_UID) { |
866 | 866 | $sequence_id = $next_uid; |
867 | - }else{ |
|
867 | + }else { |
|
868 | 868 | $sequence_id = $this->client->getConnection()->getMessageNumber($next_uid); |
869 | 869 | } |
870 | 870 | |
@@ -905,13 +905,13 @@ discard block |
||
905 | 905 | |
906 | 906 | $this->client->openFolder($this->folder_path); |
907 | 907 | if ($this->client->getConnection()->moveMessage($folder->path, $this->getSequenceId(), null, $this->sequence === IMAP::ST_UID) == true) { |
908 | - if($expunge) $this->client->expunge(); |
|
908 | + if ($expunge) $this->client->expunge(); |
|
909 | 909 | |
910 | 910 | $this->client->openFolder($folder->path); |
911 | 911 | |
912 | 912 | if ($this->sequence === IMAP::ST_UID) { |
913 | 913 | $sequence_id = $next_uid; |
914 | - }else{ |
|
914 | + }else { |
|
915 | 915 | $sequence_id = $this->client->getConnection()->getMessageNumber($next_uid); |
916 | 916 | } |
917 | 917 | |
@@ -937,7 +937,7 @@ discard block |
||
937 | 937 | */ |
938 | 938 | public function delete($expunge = true) { |
939 | 939 | $status = $this->setFlag("Deleted"); |
940 | - if($expunge) $this->client->expunge(); |
|
940 | + if ($expunge) $this->client->expunge(); |
|
941 | 941 | |
942 | 942 | $event = $this->getEvent("message", "deleted"); |
943 | 943 | $event::dispatch($this); |
@@ -956,7 +956,7 @@ discard block |
||
956 | 956 | */ |
957 | 957 | public function restore($expunge = true) { |
958 | 958 | $status = $this->unsetFlag("Deleted"); |
959 | - if($expunge) $this->client->expunge(); |
|
959 | + if ($expunge) $this->client->expunge(); |
|
960 | 960 | |
961 | 961 | $event = $this->getEvent("message", "restored"); |
962 | 962 | $event::dispatch($this); |
@@ -1057,7 +1057,7 @@ discard block |
||
1057 | 1057 | * |
1058 | 1058 | * @return AttachmentCollection |
1059 | 1059 | */ |
1060 | - public function attachments(){ |
|
1060 | + public function attachments() { |
|
1061 | 1061 | return $this->getAttachments(); |
1062 | 1062 | } |
1063 | 1063 | |
@@ -1154,7 +1154,7 @@ discard block |
||
1154 | 1154 | * |
1155 | 1155 | * @return FlagCollection |
1156 | 1156 | */ |
1157 | - public function flags(){ |
|
1157 | + public function flags() { |
|
1158 | 1158 | return $this->getFlags(); |
1159 | 1159 | } |
1160 | 1160 | |
@@ -1163,7 +1163,7 @@ discard block |
||
1163 | 1163 | * |
1164 | 1164 | * @return Structure|null |
1165 | 1165 | */ |
1166 | - public function getStructure(){ |
|
1166 | + public function getStructure() { |
|
1167 | 1167 | return $this->structure; |
1168 | 1168 | } |
1169 | 1169 | |
@@ -1189,7 +1189,7 @@ discard block |
||
1189 | 1189 | * |
1190 | 1190 | * @return array |
1191 | 1191 | */ |
1192 | - public function getAttributes(){ |
|
1192 | + public function getAttributes() { |
|
1193 | 1193 | return array_merge($this->attributes, $this->header->getAttributes()); |
1194 | 1194 | } |
1195 | 1195 | |
@@ -1199,8 +1199,8 @@ discard block |
||
1199 | 1199 | * |
1200 | 1200 | * @return $this |
1201 | 1201 | */ |
1202 | - public function setMask($mask){ |
|
1203 | - if(class_exists($mask)){ |
|
1202 | + public function setMask($mask) { |
|
1203 | + if (class_exists($mask)) { |
|
1204 | 1204 | $this->mask = $mask; |
1205 | 1205 | } |
1206 | 1206 | |
@@ -1212,7 +1212,7 @@ discard block |
||
1212 | 1212 | * |
1213 | 1213 | * @return string |
1214 | 1214 | */ |
1215 | - public function getMask(){ |
|
1215 | + public function getMask() { |
|
1216 | 1216 | return $this->mask; |
1217 | 1217 | } |
1218 | 1218 | |
@@ -1223,9 +1223,9 @@ discard block |
||
1223 | 1223 | * @return mixed |
1224 | 1224 | * @throws MaskNotFoundException |
1225 | 1225 | */ |
1226 | - public function mask($mask = null){ |
|
1226 | + public function mask($mask = null) { |
|
1227 | 1227 | $mask = $mask !== null ? $mask : $this->mask; |
1228 | - if(class_exists($mask)){ |
|
1228 | + if (class_exists($mask)) { |
|
1229 | 1229 | return new $mask($this); |
1230 | 1230 | } |
1231 | 1231 | |
@@ -1238,7 +1238,7 @@ discard block |
||
1238 | 1238 | * |
1239 | 1239 | * @return $this |
1240 | 1240 | */ |
1241 | - public function setFolderPath($folder_path){ |
|
1241 | + public function setFolderPath($folder_path) { |
|
1242 | 1242 | $this->folder_path = $folder_path; |
1243 | 1243 | |
1244 | 1244 | return $this; |
@@ -1250,7 +1250,7 @@ discard block |
||
1250 | 1250 | * |
1251 | 1251 | * @return $this |
1252 | 1252 | */ |
1253 | - public function setConfig($config){ |
|
1253 | + public function setConfig($config) { |
|
1254 | 1254 | $this->config = $config; |
1255 | 1255 | |
1256 | 1256 | return $this; |
@@ -1262,7 +1262,7 @@ discard block |
||
1262 | 1262 | * |
1263 | 1263 | * @return $this |
1264 | 1264 | */ |
1265 | - public function setAvailableFlags($available_flags){ |
|
1265 | + public function setAvailableFlags($available_flags) { |
|
1266 | 1266 | $this->available_flags = $available_flags; |
1267 | 1267 | |
1268 | 1268 | return $this; |
@@ -1274,7 +1274,7 @@ discard block |
||
1274 | 1274 | * |
1275 | 1275 | * @return $this |
1276 | 1276 | */ |
1277 | - public function setAttachments($attachments){ |
|
1277 | + public function setAttachments($attachments) { |
|
1278 | 1278 | $this->attachments = $attachments; |
1279 | 1279 | |
1280 | 1280 | return $this; |
@@ -1286,7 +1286,7 @@ discard block |
||
1286 | 1286 | * |
1287 | 1287 | * @return $this |
1288 | 1288 | */ |
1289 | - public function setFlags($flags){ |
|
1289 | + public function setFlags($flags) { |
|
1290 | 1290 | $this->flags = $flags; |
1291 | 1291 | |
1292 | 1292 | return $this; |
@@ -1299,7 +1299,7 @@ discard block |
||
1299 | 1299 | * @throws Exceptions\ConnectionFailedException |
1300 | 1300 | * @return $this |
1301 | 1301 | */ |
1302 | - public function setClient($client){ |
|
1302 | + public function setClient($client) { |
|
1303 | 1303 | $this->client = $client; |
1304 | 1304 | $this->client->openFolder($this->folder_path); |
1305 | 1305 | |
@@ -1314,7 +1314,7 @@ discard block |
||
1314 | 1314 | * @throws Exceptions\RuntimeException |
1315 | 1315 | * @return $this |
1316 | 1316 | */ |
1317 | - public function setUid($uid){ |
|
1317 | + public function setUid($uid) { |
|
1318 | 1318 | $this->uid = $uid; |
1319 | 1319 | $this->msgn = $this->client->getConnection()->getMessageNumber($this->uid); |
1320 | 1320 | $this->msglist = null; |
@@ -1331,7 +1331,7 @@ discard block |
||
1331 | 1331 | * @throws Exceptions\RuntimeException |
1332 | 1332 | * @return $this |
1333 | 1333 | */ |
1334 | - public function setMsgn($msgn, $msglist = null){ |
|
1334 | + public function setMsgn($msgn, $msglist = null) { |
|
1335 | 1335 | $this->msgn = $msgn; |
1336 | 1336 | $this->msglist = $msglist; |
1337 | 1337 | $this->uid = $this->client->getConnection()->getUid($this->msgn); |
@@ -1344,7 +1344,7 @@ discard block |
||
1344 | 1344 | * |
1345 | 1345 | * @return int |
1346 | 1346 | */ |
1347 | - public function getSequence(){ |
|
1347 | + public function getSequence() { |
|
1348 | 1348 | return $this->sequence; |
1349 | 1349 | } |
1350 | 1350 | |
@@ -1353,7 +1353,7 @@ discard block |
||
1353 | 1353 | * |
1354 | 1354 | * @return int |
1355 | 1355 | */ |
1356 | - public function getSequenceId(){ |
|
1356 | + public function getSequenceId() { |
|
1357 | 1357 | return $this->sequence === IMAP::ST_UID ? $this->uid : $this->msgn; |
1358 | 1358 | } |
1359 | 1359 | } |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | if ($this->sequence === IMAP::ST_UID) { |
228 | 228 | $this->uid = $uid; |
229 | 229 | $this->msgn = $this->client->getConnection()->getMessageNumber($this->uid); |
230 | - }else{ |
|
230 | + } else{ |
|
231 | 231 | $this->msgn = $uid; |
232 | 232 | $this->uid = $this->client->getConnection()->getUid($this->msgn); |
233 | 233 | } |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | if ($instance->getSequence() === IMAP::ST_UID) { |
295 | 295 | $instance->setUid($uid); |
296 | 296 | $instance->setMsglist($msglist); |
297 | - }else{ |
|
297 | + } else{ |
|
298 | 298 | $instance->setMsgn($uid, $msglist); |
299 | 299 | } |
300 | 300 | |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | if(strtolower(substr($method, 0, 3)) === 'get') { |
319 | 319 | $name = Str::snake(substr($method, 3)); |
320 | 320 | return $this->get($name); |
321 | - }elseif (strtolower(substr($method, 0, 3)) === 'set') { |
|
321 | + } elseif (strtolower(substr($method, 0, 3)) === 'set') { |
|
322 | 322 | $name = Str::snake(substr($method, 3)); |
323 | 323 | |
324 | 324 | if(in_array($name, array_keys($this->attributes))) { |
@@ -521,7 +521,7 @@ discard block |
||
521 | 521 | if ($this->getFlags()->get("seen") == null) { |
522 | 522 | $this->unsetFlag("Seen"); |
523 | 523 | } |
524 | - }elseif ($this->getFlags()->get("seen") != null) { |
|
524 | + } elseif ($this->getFlags()->get("seen") != null) { |
|
525 | 525 | $this->setFlag("Seen"); |
526 | 526 | } |
527 | 527 | } |
@@ -563,7 +563,7 @@ discard block |
||
563 | 563 | private function fetchPart(Part $part) { |
564 | 564 | if ($part->isAttachment()) { |
565 | 565 | $this->fetchAttachment($part); |
566 | - }else{ |
|
566 | + } else{ |
|
567 | 567 | $encoding = $this->getEncoding($part); |
568 | 568 | |
569 | 569 | $content = $this->decodeString($part->content, $part->encoding); |
@@ -755,9 +755,9 @@ discard block |
||
755 | 755 | return EncodingAliases::get($parameter->value); |
756 | 756 | } |
757 | 757 | } |
758 | - }elseif (property_exists($structure, 'charset')){ |
|
758 | + } elseif (property_exists($structure, 'charset')){ |
|
759 | 759 | return EncodingAliases::get($structure->charset); |
760 | - }elseif (is_string($structure) === true){ |
|
760 | + } elseif (is_string($structure) === true){ |
|
761 | 761 | return mb_detect_encoding($structure); |
762 | 762 | } |
763 | 763 | |
@@ -858,13 +858,15 @@ discard block |
||
858 | 858 | |
859 | 859 | $this->client->openFolder($this->folder_path); |
860 | 860 | if ($this->client->getConnection()->copyMessage($folder->path, $this->getSequenceId(), null, $this->sequence === IMAP::ST_UID) == true) { |
861 | - if($expunge) $this->client->expunge(); |
|
861 | + if($expunge) { |
|
862 | + $this->client->expunge(); |
|
863 | + } |
|
862 | 864 | |
863 | 865 | $this->client->openFolder($folder->path); |
864 | 866 | |
865 | 867 | if ($this->sequence === IMAP::ST_UID) { |
866 | 868 | $sequence_id = $next_uid; |
867 | - }else{ |
|
869 | + } else{ |
|
868 | 870 | $sequence_id = $this->client->getConnection()->getMessageNumber($next_uid); |
869 | 871 | } |
870 | 872 | |
@@ -905,13 +907,15 @@ discard block |
||
905 | 907 | |
906 | 908 | $this->client->openFolder($this->folder_path); |
907 | 909 | if ($this->client->getConnection()->moveMessage($folder->path, $this->getSequenceId(), null, $this->sequence === IMAP::ST_UID) == true) { |
908 | - if($expunge) $this->client->expunge(); |
|
910 | + if($expunge) { |
|
911 | + $this->client->expunge(); |
|
912 | + } |
|
909 | 913 | |
910 | 914 | $this->client->openFolder($folder->path); |
911 | 915 | |
912 | 916 | if ($this->sequence === IMAP::ST_UID) { |
913 | 917 | $sequence_id = $next_uid; |
914 | - }else{ |
|
918 | + } else{ |
|
915 | 919 | $sequence_id = $this->client->getConnection()->getMessageNumber($next_uid); |
916 | 920 | } |
917 | 921 | |
@@ -937,7 +941,9 @@ discard block |
||
937 | 941 | */ |
938 | 942 | public function delete($expunge = true) { |
939 | 943 | $status = $this->setFlag("Deleted"); |
940 | - if($expunge) $this->client->expunge(); |
|
944 | + if($expunge) { |
|
945 | + $this->client->expunge(); |
|
946 | + } |
|
941 | 947 | |
942 | 948 | $event = $this->getEvent("message", "deleted"); |
943 | 949 | $event::dispatch($this); |
@@ -956,7 +962,9 @@ discard block |
||
956 | 962 | */ |
957 | 963 | public function restore($expunge = true) { |
958 | 964 | $status = $this->unsetFlag("Deleted"); |
959 | - if($expunge) $this->client->expunge(); |
|
965 | + if($expunge) { |
|
966 | + $this->client->expunge(); |
|
967 | + } |
|
960 | 968 | |
961 | 969 | $event = $this->getEvent("message", "restored"); |
962 | 970 | $event::dispatch($this); |