@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | |
96 | 96 | if (ClientManager::get('options.fetch_order') === 'desc') { |
97 | 97 | $this->fetch_order = 'desc'; |
98 | - } else { |
|
98 | + }else { |
|
99 | 99 | $this->fetch_order = 'asc'; |
100 | 100 | } |
101 | 101 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | break; |
127 | 127 | } |
128 | 128 | |
129 | - return (string)$value; |
|
129 | + return (string) $value; |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | /** |
@@ -158,11 +158,11 @@ discard block |
||
158 | 158 | $this->query->each(function($statement) use (&$query) { |
159 | 159 | if (count($statement) == 1) { |
160 | 160 | $query .= $statement[0]; |
161 | - } else { |
|
161 | + }else { |
|
162 | 162 | if ($statement[1] === null) { |
163 | 163 | $query .= $statement[0]; |
164 | - } else { |
|
165 | - $query .= $statement[0] . ' "' . $statement[1] . '"'; |
|
164 | + }else { |
|
165 | + $query .= $statement[0].' "'.$statement[1].'"'; |
|
166 | 166 | } |
167 | 167 | } |
168 | 168 | $query .= ' '; |
@@ -287,15 +287,15 @@ discard block |
||
287 | 287 | } |
288 | 288 | $messages->put("$key", $message); |
289 | 289 | $msglist++; |
290 | - }catch (MessageNotFoundException $e) { |
|
290 | + } catch (MessageNotFoundException $e) { |
|
291 | 291 | $this->setError($uid, $e); |
292 | - }catch (RuntimeException $e) { |
|
292 | + } catch (RuntimeException $e) { |
|
293 | 293 | $this->setError($uid, $e); |
294 | - }catch (MessageFlagException $e) { |
|
294 | + } catch (MessageFlagException $e) { |
|
295 | 295 | $this->setError($uid, $e); |
296 | - }catch (InvalidMessageDateException $e) { |
|
296 | + } catch (InvalidMessageDateException $e) { |
|
297 | 297 | $this->setError($uid, $e); |
298 | - }catch (MessageContentFetchingException $e) { |
|
298 | + } catch (MessageContentFetchingException $e) { |
|
299 | 299 | $this->setError($uid, $e); |
300 | 300 | } |
301 | 301 | |
@@ -750,7 +750,7 @@ discard block |
||
750 | 750 | * |
751 | 751 | * @return boolean |
752 | 752 | */ |
753 | - public function hasErrors($uid = null){ |
|
753 | + public function hasErrors($uid = null) { |
|
754 | 754 | if ($uid !== null) { |
755 | 755 | return $this->hasError($uid); |
756 | 756 | } |
@@ -763,7 +763,7 @@ discard block |
||
763 | 763 | * |
764 | 764 | * @return boolean |
765 | 765 | */ |
766 | - public function hasError($uid){ |
|
766 | + public function hasError($uid) { |
|
767 | 767 | return isset($this->errors[$uid]); |
768 | 768 | } |
769 | 769 | |
@@ -772,7 +772,7 @@ discard block |
||
772 | 772 | * |
773 | 773 | * @return array |
774 | 774 | */ |
775 | - public function errors(){ |
|
775 | + public function errors() { |
|
776 | 776 | return $this->getErrors(); |
777 | 777 | } |
778 | 778 | |
@@ -781,7 +781,7 @@ discard block |
||
781 | 781 | * |
782 | 782 | * @return array |
783 | 783 | */ |
784 | - public function getErrors(){ |
|
784 | + public function getErrors() { |
|
785 | 785 | return $this->errors; |
786 | 786 | } |
787 | 787 | |
@@ -791,7 +791,7 @@ discard block |
||
791 | 791 | * |
792 | 792 | * @return Exception|null |
793 | 793 | */ |
794 | - public function error($uid){ |
|
794 | + public function error($uid) { |
|
795 | 795 | return $this->getError($uid); |
796 | 796 | } |
797 | 797 | |
@@ -801,7 +801,7 @@ discard block |
||
801 | 801 | * |
802 | 802 | * @return Exception|null |
803 | 803 | */ |
804 | - public function getError($uid){ |
|
804 | + public function getError($uid) { |
|
805 | 805 | if ($this->hasError($uid)) { |
806 | 806 | return $this->errors[$uid]; |
807 | 807 | } |
@@ -91,7 +91,9 @@ discard block |
||
91 | 91 | $this->setClient($client); |
92 | 92 | |
93 | 93 | $this->sequence = ClientManager::get('options.sequence', IMAP::ST_MSGN); |
94 | - if (ClientManager::get('options.fetch') === IMAP::FT_PEEK) $this->leaveUnread(); |
|
94 | + if (ClientManager::get('options.fetch') === IMAP::FT_PEEK) { |
|
95 | + $this->leaveUnread(); |
|
96 | + } |
|
95 | 97 | |
96 | 98 | if (ClientManager::get('options.fetch_order') === 'desc') { |
97 | 99 | $this->fetch_order = 'desc'; |
@@ -137,7 +139,9 @@ discard block |
||
137 | 139 | * @throws MessageSearchValidationException |
138 | 140 | */ |
139 | 141 | protected function parse_date($date) { |
140 | - if ($date instanceof Carbon) return $date; |
|
142 | + if ($date instanceof Carbon) { |
|
143 | + return $date; |
|
144 | + } |
|
141 | 145 | |
142 | 146 | try { |
143 | 147 | $date = Carbon::parse($date); |
@@ -287,15 +291,15 @@ discard block |
||
287 | 291 | } |
288 | 292 | $messages->put("$key", $message); |
289 | 293 | $msglist++; |
290 | - }catch (MessageNotFoundException $e) { |
|
294 | + } catch (MessageNotFoundException $e) { |
|
291 | 295 | $this->setError($uid, $e); |
292 | - }catch (RuntimeException $e) { |
|
296 | + } catch (RuntimeException $e) { |
|
293 | 297 | $this->setError($uid, $e); |
294 | - }catch (MessageFlagException $e) { |
|
298 | + } catch (MessageFlagException $e) { |
|
295 | 299 | $this->setError($uid, $e); |
296 | - }catch (InvalidMessageDateException $e) { |
|
300 | + } catch (InvalidMessageDateException $e) { |
|
297 | 301 | $this->setError($uid, $e); |
298 | - }catch (MessageContentFetchingException $e) { |
|
302 | + } catch (MessageContentFetchingException $e) { |
|
299 | 303 | $this->setError($uid, $e); |
300 | 304 | } |
301 | 305 | |
@@ -492,7 +496,9 @@ discard block |
||
492 | 496 | * @return $this |
493 | 497 | */ |
494 | 498 | public function limit($limit, $page = 1) { |
495 | - if ($page >= 1) $this->page = $page; |
|
499 | + if ($page >= 1) { |
|
500 | + $this->page = $page; |
|
501 | + } |
|
496 | 502 | $this->limit = $limit; |
497 | 503 | |
498 | 504 | return $this; |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | public function __construct($uid, $msglist, Client $client, $fetch_options = null, $fetch_body = false, $fetch_flags = false, $sequence = null) { |
206 | 206 | |
207 | 207 | $default_mask = $client->getDefaultMessageMask(); |
208 | - if($default_mask != null) { |
|
208 | + if ($default_mask != null) { |
|
209 | 209 | $this->mask = $default_mask; |
210 | 210 | } |
211 | 211 | $this->events["message"] = $client->getDefaultEvents("message"); |
@@ -265,13 +265,13 @@ discard block |
||
265 | 265 | * @throws Exceptions\RuntimeException |
266 | 266 | * @throws Exceptions\MessageNotFoundException |
267 | 267 | */ |
268 | - public static function make($uid, $msglist, Client $client, $raw_header, $raw_body, $raw_flags, $fetch_options = null, $sequence = null){ |
|
268 | + public static function make($uid, $msglist, Client $client, $raw_header, $raw_body, $raw_flags, $fetch_options = null, $sequence = null) { |
|
269 | 269 | $reflection = new ReflectionClass(self::class); |
270 | 270 | /** @var self $instance */ |
271 | 271 | $instance = $reflection->newInstanceWithoutConstructor(); |
272 | 272 | |
273 | 273 | $default_mask = $client->getDefaultMessageMask(); |
274 | - if($default_mask != null) { |
|
274 | + if ($default_mask != null) { |
|
275 | 275 | $instance->setMask($default_mask); |
276 | 276 | } |
277 | 277 | $instance->setEvents([ |
@@ -306,13 +306,13 @@ discard block |
||
306 | 306 | * @throws MethodNotFoundException |
307 | 307 | */ |
308 | 308 | public function __call($method, $arguments) { |
309 | - if(strtolower(substr($method, 0, 3)) === 'get') { |
|
309 | + if (strtolower(substr($method, 0, 3)) === 'get') { |
|
310 | 310 | $name = Str::snake(substr($method, 3)); |
311 | 311 | return $this->get($name); |
312 | 312 | }elseif (strtolower(substr($method, 0, 3)) === 'set') { |
313 | 313 | $name = Str::snake(substr($method, 3)); |
314 | 314 | |
315 | - if(in_array($name, array_keys($this->attributes))) { |
|
315 | + if (in_array($name, array_keys($this->attributes))) { |
|
316 | 316 | return $this->__set($name, array_pop($arguments)); |
317 | 317 | } |
318 | 318 | |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | * @return mixed|null |
352 | 352 | */ |
353 | 353 | public function get($name) { |
354 | - if(isset($this->attributes[$name])) { |
|
354 | + if (isset($this->attributes[$name])) { |
|
355 | 355 | return $this->attributes[$name]; |
356 | 356 | } |
357 | 357 | |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | * |
426 | 426 | * @throws InvalidMessageDateException |
427 | 427 | */ |
428 | - public function parseRawHeader($raw_header){ |
|
428 | + public function parseRawHeader($raw_header) { |
|
429 | 429 | $this->header = new Header($raw_header); |
430 | 430 | } |
431 | 431 | |
@@ -436,8 +436,8 @@ discard block |
||
436 | 436 | public function parseRawFlags($raw_flags) { |
437 | 437 | $this->flags = FlagCollection::make([]); |
438 | 438 | |
439 | - foreach($raw_flags as $flag) { |
|
440 | - if (strpos($flag, "\\") === 0){ |
|
439 | + foreach ($raw_flags as $flag) { |
|
440 | + if (strpos($flag, "\\") === 0) { |
|
441 | 441 | $flag = substr($flag, 1); |
442 | 442 | } |
443 | 443 | $flag_key = strtolower($flag); |
@@ -510,7 +510,7 @@ discard block |
||
510 | 510 | * @throws MessageFlagException |
511 | 511 | * @throws Exceptions\RuntimeException |
512 | 512 | */ |
513 | - public function peek(){ |
|
513 | + public function peek() { |
|
514 | 514 | if ($this->fetch_options == IMAP::FT_PEEK) { |
515 | 515 | if ($this->getFlags()->get("seen") == null) { |
516 | 516 | $this->unsetFlag("Seen"); |
@@ -559,7 +559,7 @@ discard block |
||
559 | 559 | private function fetchPart(Part $part) { |
560 | 560 | if ($part->isAttachment()) { |
561 | 561 | $this->fetchAttachment($part); |
562 | - }else{ |
|
562 | + }else { |
|
563 | 563 | $encoding = $this->getEncoding($part); |
564 | 564 | |
565 | 565 | $content = $this->decodeString($part->content, $part->encoding); |
@@ -584,7 +584,7 @@ discard block |
||
584 | 584 | |
585 | 585 | if (isset($this->bodies[$subtype])) { |
586 | 586 | $this->bodies[$subtype] .= "\n".$content; |
587 | - }else{ |
|
587 | + }else { |
|
588 | 588 | $this->bodies[$subtype] = $content; |
589 | 589 | } |
590 | 590 | } |
@@ -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 | |
@@ -772,7 +772,7 @@ discard block |
||
772 | 772 | * @throws Exceptions\FolderFetchingException |
773 | 773 | * @throws Exceptions\RuntimeException |
774 | 774 | */ |
775 | - public function getFolder(){ |
|
775 | + public function getFolder() { |
|
776 | 776 | return $this->client->getFolder($this->folder_path); |
777 | 777 | } |
778 | 778 | |
@@ -788,13 +788,13 @@ discard block |
||
788 | 788 | * @throws Exceptions\GetMessagesFailedException |
789 | 789 | * @throws Exceptions\RuntimeException |
790 | 790 | */ |
791 | - public function thread($sent_folder = null, &$thread = null, $folder = null){ |
|
791 | + public function thread($sent_folder = null, &$thread = null, $folder = null) { |
|
792 | 792 | $thread = $thread ? $thread : MessageCollection::make([]); |
793 | - $folder = $folder ? $folder : $this->getFolder(); |
|
793 | + $folder = $folder ? $folder : $this->getFolder(); |
|
794 | 794 | $sent_folder = $sent_folder ? $sent_folder : $this->client->getFolder(ClientManager::get("options.common_folders.sent", "INBOX/Sent")); |
795 | 795 | |
796 | 796 | /** @var Message $message */ |
797 | - foreach($thread as $message) { |
|
797 | + foreach ($thread as $message) { |
|
798 | 798 | if ($message->message_id == $this->message_id) { |
799 | 799 | return $thread; |
800 | 800 | } |
@@ -805,7 +805,7 @@ discard block |
||
805 | 805 | $this->fetchThreadByInReplyTo($thread, $this->message_id, $sent_folder, $folder, $sent_folder); |
806 | 806 | |
807 | 807 | if (is_array($this->in_reply_to)) { |
808 | - foreach($this->in_reply_to as $in_reply_to) { |
|
808 | + foreach ($this->in_reply_to as $in_reply_to) { |
|
809 | 809 | $this->fetchThreadByMessageId($thread, $in_reply_to, $folder, $folder, $sent_folder); |
810 | 810 | $this->fetchThreadByMessageId($thread, $in_reply_to, $sent_folder, $folder, $sent_folder); |
811 | 811 | } |
@@ -826,7 +826,7 @@ discard block |
||
826 | 826 | * @throws Exceptions\GetMessagesFailedException |
827 | 827 | * @throws Exceptions\RuntimeException |
828 | 828 | */ |
829 | - protected function fetchThreadByInReplyTo(&$thread, $in_reply_to, $primary_folder, $secondary_folder, $sent_folder){ |
|
829 | + protected function fetchThreadByInReplyTo(&$thread, $in_reply_to, $primary_folder, $secondary_folder, $sent_folder) { |
|
830 | 830 | $primary_folder->query()->inReplyTo($in_reply_to) |
831 | 831 | ->setFetchBody($this->getFetchBodyOption()) |
832 | 832 | ->leaveUnread()->get()->each(function($message) use(&$thread, $secondary_folder, $sent_folder){ |
@@ -847,7 +847,7 @@ discard block |
||
847 | 847 | * @throws Exceptions\GetMessagesFailedException |
848 | 848 | * @throws Exceptions\RuntimeException |
849 | 849 | */ |
850 | - protected function fetchThreadByMessageId(&$thread, $message_id, $primary_folder, $secondary_folder, $sent_folder){ |
|
850 | + protected function fetchThreadByMessageId(&$thread, $message_id, $primary_folder, $secondary_folder, $sent_folder) { |
|
851 | 851 | $primary_folder->query()->messageId($message_id) |
852 | 852 | ->setFetchBody($this->getFetchBodyOption()) |
853 | 853 | ->leaveUnread()->get()->each(function($message) use(&$thread, $secondary_folder, $sent_folder){ |
@@ -943,14 +943,14 @@ discard block |
||
943 | 943 | * @throws MessageFlagException |
944 | 944 | * @throws MessageHeaderFetchingException |
945 | 945 | */ |
946 | - protected function fetchNewMail($folder, $next_uid, $event, $expunge){ |
|
947 | - if($expunge) $this->client->expunge(); |
|
946 | + protected function fetchNewMail($folder, $next_uid, $event, $expunge) { |
|
947 | + if ($expunge) $this->client->expunge(); |
|
948 | 948 | |
949 | 949 | $this->client->openFolder($folder->path); |
950 | 950 | |
951 | 951 | if ($this->sequence === IMAP::ST_UID) { |
952 | 952 | $sequence_id = $next_uid; |
953 | - }else{ |
|
953 | + }else { |
|
954 | 954 | $sequence_id = $this->client->getConnection()->getMessageNumber($next_uid); |
955 | 955 | } |
956 | 956 | |
@@ -973,7 +973,7 @@ discard block |
||
973 | 973 | */ |
974 | 974 | public function delete($expunge = true) { |
975 | 975 | $status = $this->setFlag("Deleted"); |
976 | - if($expunge) $this->client->expunge(); |
|
976 | + if ($expunge) $this->client->expunge(); |
|
977 | 977 | |
978 | 978 | $event = $this->getEvent("message", "deleted"); |
979 | 979 | $event::dispatch($this); |
@@ -993,7 +993,7 @@ discard block |
||
993 | 993 | */ |
994 | 994 | public function restore($expunge = true) { |
995 | 995 | $status = $this->unsetFlag("Deleted"); |
996 | - if($expunge) $this->client->expunge(); |
|
996 | + if ($expunge) $this->client->expunge(); |
|
997 | 997 | |
998 | 998 | $event = $this->getEvent("message", "restored"); |
999 | 999 | $event::dispatch($this); |
@@ -1098,7 +1098,7 @@ discard block |
||
1098 | 1098 | * |
1099 | 1099 | * @return AttachmentCollection |
1100 | 1100 | */ |
1101 | - public function attachments(){ |
|
1101 | + public function attachments() { |
|
1102 | 1102 | return $this->getAttachments(); |
1103 | 1103 | } |
1104 | 1104 | |
@@ -1196,7 +1196,7 @@ discard block |
||
1196 | 1196 | * |
1197 | 1197 | * @return FlagCollection |
1198 | 1198 | */ |
1199 | - public function flags(){ |
|
1199 | + public function flags() { |
|
1200 | 1200 | return $this->getFlags(); |
1201 | 1201 | } |
1202 | 1202 | |
@@ -1205,7 +1205,7 @@ discard block |
||
1205 | 1205 | * |
1206 | 1206 | * @return Structure|null |
1207 | 1207 | */ |
1208 | - public function getStructure(){ |
|
1208 | + public function getStructure() { |
|
1209 | 1209 | return $this->structure; |
1210 | 1210 | } |
1211 | 1211 | |
@@ -1231,7 +1231,7 @@ discard block |
||
1231 | 1231 | * |
1232 | 1232 | * @return array |
1233 | 1233 | */ |
1234 | - public function getAttributes(){ |
|
1234 | + public function getAttributes() { |
|
1235 | 1235 | return array_merge($this->attributes, $this->header->getAttributes()); |
1236 | 1236 | } |
1237 | 1237 | |
@@ -1241,8 +1241,8 @@ discard block |
||
1241 | 1241 | * |
1242 | 1242 | * @return $this |
1243 | 1243 | */ |
1244 | - public function setMask($mask){ |
|
1245 | - if(class_exists($mask)){ |
|
1244 | + public function setMask($mask) { |
|
1245 | + if (class_exists($mask)) { |
|
1246 | 1246 | $this->mask = $mask; |
1247 | 1247 | } |
1248 | 1248 | |
@@ -1254,7 +1254,7 @@ discard block |
||
1254 | 1254 | * |
1255 | 1255 | * @return string |
1256 | 1256 | */ |
1257 | - public function getMask(){ |
|
1257 | + public function getMask() { |
|
1258 | 1258 | return $this->mask; |
1259 | 1259 | } |
1260 | 1260 | |
@@ -1265,9 +1265,9 @@ discard block |
||
1265 | 1265 | * @return mixed |
1266 | 1266 | * @throws MaskNotFoundException |
1267 | 1267 | */ |
1268 | - public function mask($mask = null){ |
|
1268 | + public function mask($mask = null) { |
|
1269 | 1269 | $mask = $mask !== null ? $mask : $this->mask; |
1270 | - if(class_exists($mask)){ |
|
1270 | + if (class_exists($mask)) { |
|
1271 | 1271 | return new $mask($this); |
1272 | 1272 | } |
1273 | 1273 | |
@@ -1280,7 +1280,7 @@ discard block |
||
1280 | 1280 | * |
1281 | 1281 | * @return $this |
1282 | 1282 | */ |
1283 | - public function setFolderPath($folder_path){ |
|
1283 | + public function setFolderPath($folder_path) { |
|
1284 | 1284 | $this->folder_path = $folder_path; |
1285 | 1285 | |
1286 | 1286 | return $this; |
@@ -1292,7 +1292,7 @@ discard block |
||
1292 | 1292 | * |
1293 | 1293 | * @return $this |
1294 | 1294 | */ |
1295 | - public function setConfig($config){ |
|
1295 | + public function setConfig($config) { |
|
1296 | 1296 | $this->config = $config; |
1297 | 1297 | |
1298 | 1298 | return $this; |
@@ -1304,7 +1304,7 @@ discard block |
||
1304 | 1304 | * |
1305 | 1305 | * @return $this |
1306 | 1306 | */ |
1307 | - public function setAvailableFlags($available_flags){ |
|
1307 | + public function setAvailableFlags($available_flags) { |
|
1308 | 1308 | $this->available_flags = $available_flags; |
1309 | 1309 | |
1310 | 1310 | return $this; |
@@ -1316,7 +1316,7 @@ discard block |
||
1316 | 1316 | * |
1317 | 1317 | * @return $this |
1318 | 1318 | */ |
1319 | - public function setAttachments($attachments){ |
|
1319 | + public function setAttachments($attachments) { |
|
1320 | 1320 | $this->attachments = $attachments; |
1321 | 1321 | |
1322 | 1322 | return $this; |
@@ -1328,7 +1328,7 @@ discard block |
||
1328 | 1328 | * |
1329 | 1329 | * @return $this |
1330 | 1330 | */ |
1331 | - public function setFlags($flags){ |
|
1331 | + public function setFlags($flags) { |
|
1332 | 1332 | $this->flags = $flags; |
1333 | 1333 | |
1334 | 1334 | return $this; |
@@ -1342,7 +1342,7 @@ discard block |
||
1342 | 1342 | * @throws Exceptions\RuntimeException |
1343 | 1343 | * @throws Exceptions\ConnectionFailedException |
1344 | 1344 | */ |
1345 | - public function setClient($client){ |
|
1345 | + public function setClient($client) { |
|
1346 | 1346 | $this->client = $client; |
1347 | 1347 | $this->client->openFolder($this->folder_path); |
1348 | 1348 | |
@@ -1357,7 +1357,7 @@ discard block |
||
1357 | 1357 | * @throws Exceptions\MessageNotFoundException |
1358 | 1358 | * @throws Exceptions\ConnectionFailedException |
1359 | 1359 | */ |
1360 | - public function setUid($uid){ |
|
1360 | + public function setUid($uid) { |
|
1361 | 1361 | $this->uid = $uid; |
1362 | 1362 | $this->msgn = $this->client->getConnection()->getMessageNumber($this->uid); |
1363 | 1363 | $this->msglist = null; |
@@ -1374,7 +1374,7 @@ discard block |
||
1374 | 1374 | * @throws Exceptions\MessageNotFoundException |
1375 | 1375 | * @throws Exceptions\ConnectionFailedException |
1376 | 1376 | */ |
1377 | - public function setMsgn($msgn, $msglist = null){ |
|
1377 | + public function setMsgn($msgn, $msglist = null) { |
|
1378 | 1378 | $this->msgn = $msgn; |
1379 | 1379 | $this->msglist = $msglist; |
1380 | 1380 | $this->uid = $this->client->getConnection()->getUid($this->msgn); |
@@ -1387,7 +1387,7 @@ discard block |
||
1387 | 1387 | * |
1388 | 1388 | * @return int |
1389 | 1389 | */ |
1390 | - public function getSequence(){ |
|
1390 | + public function getSequence() { |
|
1391 | 1391 | return $this->sequence; |
1392 | 1392 | } |
1393 | 1393 | |
@@ -1396,7 +1396,7 @@ discard block |
||
1396 | 1396 | * |
1397 | 1397 | * @return int |
1398 | 1398 | */ |
1399 | - public function getSequenceId(){ |
|
1399 | + public function getSequenceId() { |
|
1400 | 1400 | return $this->sequence === IMAP::ST_UID ? $this->uid : $this->msgn; |
1401 | 1401 | } |
1402 | 1402 | |
@@ -1408,11 +1408,11 @@ discard block |
||
1408 | 1408 | * @throws Exceptions\ConnectionFailedException |
1409 | 1409 | * @throws Exceptions\MessageNotFoundException |
1410 | 1410 | */ |
1411 | - public function setSequenceId($uid, $msglist = null){ |
|
1411 | + public function setSequenceId($uid, $msglist = null) { |
|
1412 | 1412 | if ($this->getSequence() === IMAP::ST_UID) { |
1413 | 1413 | $this->setUid($uid); |
1414 | 1414 | $this->setMsglist($msglist); |
1415 | - }else{ |
|
1415 | + }else { |
|
1416 | 1416 | $this->setMsgn($uid, $msglist); |
1417 | 1417 | } |
1418 | 1418 | } |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | |
123 | 123 | $this->setDelimiter($delimiter); |
124 | 124 | $this->path = $folder_name; |
125 | - $this->full_name = $this->decodeName($folder_name); |
|
125 | + $this->full_name = $this->decodeName($folder_name); |
|
126 | 126 | $this->name = $this->getSimpleName($this->delimiter, $this->full_name); |
127 | 127 | |
128 | 128 | $this->parseAttributes($attributes); |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | * @throws Exceptions\ConnectionFailedException |
137 | 137 | * @throws Exceptions\RuntimeException |
138 | 138 | */ |
139 | - public function query($charset = 'UTF-8'){ |
|
139 | + public function query($charset = 'UTF-8') { |
|
140 | 140 | $this->getClient()->checkConnection(); |
141 | 141 | $this->getClient()->openFolder($this->path); |
142 | 142 | |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | * @throws Exceptions\ConnectionFailedException |
149 | 149 | * @throws Exceptions\RuntimeException |
150 | 150 | */ |
151 | - public function search($charset = 'UTF-8'){ |
|
151 | + public function search($charset = 'UTF-8') { |
|
152 | 152 | return $this->query($charset); |
153 | 153 | } |
154 | 154 | |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | * @throws Exceptions\ConnectionFailedException |
158 | 158 | * @throws Exceptions\RuntimeException |
159 | 159 | */ |
160 | - public function messages($charset = 'UTF-8'){ |
|
160 | + public function messages($charset = 'UTF-8') { |
|
161 | 161 | return $this->query($charset); |
162 | 162 | } |
163 | 163 | |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | public function move($new_name, $expunge = true) { |
233 | 233 | $this->client->checkConnection(); |
234 | 234 | $status = $this->client->getConnection()->renameFolder($this->full_name, $new_name); |
235 | - if($expunge) $this->client->expunge(); |
|
235 | + if ($expunge) $this->client->expunge(); |
|
236 | 236 | |
237 | 237 | $folder = $this->client->getFolder($new_name); |
238 | 238 | $event = $this->getEvent("folder", "moved"); |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | * @throws Exceptions\MessageNotFoundException |
252 | 252 | * @throws Exceptions\RuntimeException |
253 | 253 | */ |
254 | - public function overview($sequence = null){ |
|
254 | + public function overview($sequence = null) { |
|
255 | 255 | $this->client->openFolder($this->path); |
256 | 256 | $sequence = $sequence === null ? "1:*" : $sequence; |
257 | 257 | $uid = ClientManager::get('options.sequence', IMAP::ST_MSGN) == IMAP::ST_UID; |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | */ |
277 | 277 | |
278 | 278 | if ($internal_date != null) { |
279 | - if ($internal_date instanceof Carbon){ |
|
279 | + if ($internal_date instanceof Carbon) { |
|
280 | 280 | $internal_date = $internal_date->format('d-M-Y H:i:s O'); |
281 | 281 | } |
282 | 282 | } |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | */ |
311 | 311 | public function delete($expunge = true) { |
312 | 312 | $status = $this->client->getConnection()->deleteFolder($this->path); |
313 | - if($expunge) $this->client->expunge(); |
|
313 | + if ($expunge) $this->client->expunge(); |
|
314 | 314 | |
315 | 315 | $event = $this->getEvent("folder", "deleted"); |
316 | 316 | $event::dispatch($this); |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | try { |
372 | 372 | $line = $connection->nextLine(); |
373 | 373 | if (($pos = strpos($line, "EXISTS")) !== false) { |
374 | - $msgn = (int) substr($line, 2, $pos -2); |
|
374 | + $msgn = (int) substr($line, 2, $pos - 2); |
|
375 | 375 | $connection->done(); |
376 | 376 | |
377 | 377 | $this->client->openFolder($this->path, true); |
@@ -384,8 +384,8 @@ discard block |
||
384 | 384 | |
385 | 385 | $connection->idle(); |
386 | 386 | } |
387 | - }catch (Exceptions\RuntimeException $e) { |
|
388 | - if(strpos($e->getMessage(), "connection closed") === false) { |
|
387 | + } catch (Exceptions\RuntimeException $e) { |
|
388 | + if (strpos($e->getMessage(), "connection closed") === false) { |
|
389 | 389 | throw $e; |
390 | 390 | } |
391 | 391 | if ($auto_reconnect === true) { |
@@ -434,8 +434,8 @@ discard block |
||
434 | 434 | * Set the delimiter |
435 | 435 | * @param $delimiter |
436 | 436 | */ |
437 | - public function setDelimiter($delimiter){ |
|
438 | - if(in_array($delimiter, [null, '', ' ', false]) === true) { |
|
437 | + public function setDelimiter($delimiter) { |
|
438 | + if (in_array($delimiter, [null, '', ' ', false]) === true) { |
|
439 | 439 | $delimiter = ClientManager::get('options.delimiter', '/'); |
440 | 440 | } |
441 | 441 |