@@ -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,14 +158,14 @@ 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 { |
|
| 164 | + }else { |
|
| 165 | 165 | if (is_numeric($statement[1])) { |
| 166 | - $query .= $statement[0] . ' ' . $statement[1]; |
|
| 167 | - } else { |
|
| 168 | - $query .= $statement[0] . ' "' . $statement[1] . '"'; |
|
| 166 | + $query .= $statement[0].' '.$statement[1]; |
|
| 167 | + }else { |
|
| 168 | + $query .= $statement[0].' "'.$statement[1].'"'; |
|
| 169 | 169 | } |
| 170 | 170 | } |
| 171 | 171 | } |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | $key = $message->getMessageId(); |
| 300 | 300 | break; |
| 301 | 301 | } |
| 302 | - return (string)$key; |
|
| 302 | + return (string) $key; |
|
| 303 | 303 | } |
| 304 | 304 | |
| 305 | 305 | /** |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | $extensions = isset($raw_messages["extensions"][$uid]) ? $raw_messages["extensions"][$uid] : []; |
| 330 | 330 | |
| 331 | 331 | $message = $this->make($uid, $msglist, $header, $content, $flag); |
| 332 | - foreach($extensions as $key => $extension) { |
|
| 332 | + foreach ($extensions as $key => $extension) { |
|
| 333 | 333 | $message->getHeader()->set($key, $extension); |
| 334 | 334 | } |
| 335 | 335 | if ($message !== null) { |
@@ -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); |
@@ -533,7 +537,9 @@ discard block |
||
| 533 | 537 | * @return $this |
| 534 | 538 | */ |
| 535 | 539 | public function limit($limit, $page = 1) { |
| 536 | - if ($page >= 1) $this->page = $page; |
|
| 540 | + if ($page >= 1) { |
|
| 541 | + $this->page = $page; |
|
| 542 | + } |
|
| 537 | 543 | $this->limit = $limit; |
| 538 | 544 | |
| 539 | 545 | return $this; |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | $this->boot(); |
| 193 | 193 | |
| 194 | 194 | $default_mask = $client->getDefaultMessageMask(); |
| 195 | - if($default_mask != null) { |
|
| 195 | + if ($default_mask != null) { |
|
| 196 | 196 | $this->mask = $default_mask; |
| 197 | 197 | } |
| 198 | 198 | $this->events["message"] = $client->getDefaultEvents("message"); |
@@ -246,14 +246,14 @@ discard block |
||
| 246 | 246 | * @throws Exceptions\RuntimeException |
| 247 | 247 | * @throws Exceptions\MessageNotFoundException |
| 248 | 248 | */ |
| 249 | - public static function make($uid, $msglist, Client $client, $raw_header, $raw_body, $raw_flags, $fetch_options = null, $sequence = null){ |
|
| 249 | + public static function make($uid, $msglist, Client $client, $raw_header, $raw_body, $raw_flags, $fetch_options = null, $sequence = null) { |
|
| 250 | 250 | $reflection = new ReflectionClass(self::class); |
| 251 | 251 | /** @var self $instance */ |
| 252 | 252 | $instance = $reflection->newInstanceWithoutConstructor(); |
| 253 | 253 | $instance->boot(); |
| 254 | 254 | |
| 255 | 255 | $default_mask = $client->getDefaultMessageMask(); |
| 256 | - if($default_mask != null) { |
|
| 256 | + if ($default_mask != null) { |
|
| 257 | 257 | $instance->setMask($default_mask); |
| 258 | 258 | } |
| 259 | 259 | $instance->setEvents([ |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | /** |
| 279 | 279 | * Boot a new instance |
| 280 | 280 | */ |
| 281 | - public function boot(){ |
|
| 281 | + public function boot() { |
|
| 282 | 282 | $this->attributes = []; |
| 283 | 283 | |
| 284 | 284 | $this->config = ClientManager::get('options'); |
@@ -297,13 +297,13 @@ discard block |
||
| 297 | 297 | * @throws MethodNotFoundException |
| 298 | 298 | */ |
| 299 | 299 | public function __call($method, $arguments) { |
| 300 | - if(strtolower(substr($method, 0, 3)) === 'get') { |
|
| 300 | + if (strtolower(substr($method, 0, 3)) === 'get') { |
|
| 301 | 301 | $name = Str::snake(substr($method, 3)); |
| 302 | 302 | return $this->get($name); |
| 303 | 303 | }elseif (strtolower(substr($method, 0, 3)) === 'set') { |
| 304 | 304 | $name = Str::snake(substr($method, 3)); |
| 305 | 305 | |
| 306 | - if(in_array($name, array_keys($this->attributes))) { |
|
| 306 | + if (in_array($name, array_keys($this->attributes))) { |
|
| 307 | 307 | return $this->__set($name, array_pop($arguments)); |
| 308 | 308 | } |
| 309 | 309 | |
@@ -342,7 +342,7 @@ discard block |
||
| 342 | 342 | * @return Attribute|mixed|null |
| 343 | 343 | */ |
| 344 | 344 | public function get($name) { |
| 345 | - if(isset($this->attributes[$name])) { |
|
| 345 | + if (isset($this->attributes[$name])) { |
|
| 346 | 346 | return $this->attributes[$name]; |
| 347 | 347 | } |
| 348 | 348 | |
@@ -416,7 +416,7 @@ discard block |
||
| 416 | 416 | * |
| 417 | 417 | * @throws InvalidMessageDateException |
| 418 | 418 | */ |
| 419 | - public function parseRawHeader($raw_header){ |
|
| 419 | + public function parseRawHeader($raw_header) { |
|
| 420 | 420 | $this->header = new Header($raw_header); |
| 421 | 421 | } |
| 422 | 422 | |
@@ -427,8 +427,8 @@ discard block |
||
| 427 | 427 | public function parseRawFlags($raw_flags) { |
| 428 | 428 | $this->flags = FlagCollection::make([]); |
| 429 | 429 | |
| 430 | - foreach($raw_flags as $flag) { |
|
| 431 | - if (strpos($flag, "\\") === 0){ |
|
| 430 | + foreach ($raw_flags as $flag) { |
|
| 431 | + if (strpos($flag, "\\") === 0) { |
|
| 432 | 432 | $flag = substr($flag, 1); |
| 433 | 433 | } |
| 434 | 434 | $flag_key = strtolower($flag); |
@@ -501,7 +501,7 @@ discard block |
||
| 501 | 501 | * @throws MessageFlagException |
| 502 | 502 | * @throws Exceptions\RuntimeException |
| 503 | 503 | */ |
| 504 | - public function peek(){ |
|
| 504 | + public function peek() { |
|
| 505 | 505 | if ($this->fetch_options == IMAP::FT_PEEK) { |
| 506 | 506 | if ($this->getFlags()->get("seen") == null) { |
| 507 | 507 | $this->unsetFlag("Seen"); |
@@ -550,7 +550,7 @@ discard block |
||
| 550 | 550 | private function fetchPart(Part $part) { |
| 551 | 551 | if ($part->isAttachment()) { |
| 552 | 552 | $this->fetchAttachment($part); |
| 553 | - }else{ |
|
| 553 | + }else { |
|
| 554 | 554 | $encoding = $this->getEncoding($part); |
| 555 | 555 | |
| 556 | 556 | $content = $this->decodeString($part->content, $part->encoding); |
@@ -575,7 +575,7 @@ discard block |
||
| 575 | 575 | |
| 576 | 576 | if (isset($this->bodies[$subtype])) { |
| 577 | 577 | $this->bodies[$subtype] .= "\n".$content; |
| 578 | - }else{ |
|
| 578 | + }else { |
|
| 579 | 579 | $this->bodies[$subtype] = $content; |
| 580 | 580 | } |
| 581 | 581 | } |
@@ -591,7 +591,7 @@ discard block |
||
| 591 | 591 | if ($oAttachment->getName() !== null && $oAttachment->getSize() > 0) { |
| 592 | 592 | if ($oAttachment->getId() !== null) { |
| 593 | 593 | $this->attachments->put($oAttachment->getId(), $oAttachment); |
| 594 | - } else { |
|
| 594 | + }else { |
|
| 595 | 595 | $this->attachments->push($oAttachment); |
| 596 | 596 | } |
| 597 | 597 | } |
@@ -725,7 +725,7 @@ discard block |
||
| 725 | 725 | |
| 726 | 726 | if (function_exists('iconv') && $from != 'UTF-7' && $to != 'UTF-7') { |
| 727 | 727 | return @iconv($from, $to.'//IGNORE', $str); |
| 728 | - } else { |
|
| 728 | + }else { |
|
| 729 | 729 | if (!$from) { |
| 730 | 730 | return mb_convert_encoding($str, $to); |
| 731 | 731 | } |
@@ -746,9 +746,9 @@ discard block |
||
| 746 | 746 | return EncodingAliases::get($parameter->value); |
| 747 | 747 | } |
| 748 | 748 | } |
| 749 | - }elseif (property_exists($structure, 'charset')){ |
|
| 749 | + }elseif (property_exists($structure, 'charset')) { |
|
| 750 | 750 | return EncodingAliases::get($structure->charset); |
| 751 | - }elseif (is_string($structure) === true){ |
|
| 751 | + }elseif (is_string($structure) === true) { |
|
| 752 | 752 | return mb_detect_encoding($structure); |
| 753 | 753 | } |
| 754 | 754 | |
@@ -763,7 +763,7 @@ discard block |
||
| 763 | 763 | * @throws Exceptions\FolderFetchingException |
| 764 | 764 | * @throws Exceptions\RuntimeException |
| 765 | 765 | */ |
| 766 | - public function getFolder(){ |
|
| 766 | + public function getFolder() { |
|
| 767 | 767 | return $this->client->getFolderByPath($this->folder_path); |
| 768 | 768 | } |
| 769 | 769 | |
@@ -779,13 +779,13 @@ discard block |
||
| 779 | 779 | * @throws Exceptions\GetMessagesFailedException |
| 780 | 780 | * @throws Exceptions\RuntimeException |
| 781 | 781 | */ |
| 782 | - public function thread($sent_folder = null, &$thread = null, $folder = null){ |
|
| 782 | + public function thread($sent_folder = null, &$thread = null, $folder = null) { |
|
| 783 | 783 | $thread = $thread ? $thread : MessageCollection::make([]); |
| 784 | - $folder = $folder ? $folder : $this->getFolder(); |
|
| 784 | + $folder = $folder ? $folder : $this->getFolder(); |
|
| 785 | 785 | $sent_folder = $sent_folder ? $sent_folder : $this->client->getFolderByPath(ClientManager::get("options.common_folders.sent", "INBOX/Sent")); |
| 786 | 786 | |
| 787 | 787 | /** @var Message $message */ |
| 788 | - foreach($thread as $message) { |
|
| 788 | + foreach ($thread as $message) { |
|
| 789 | 789 | if ($message->message_id->first() == $this->message_id->first()) { |
| 790 | 790 | return $thread; |
| 791 | 791 | } |
@@ -796,7 +796,7 @@ discard block |
||
| 796 | 796 | $this->fetchThreadByInReplyTo($thread, $this->message_id, $sent_folder, $folder, $sent_folder); |
| 797 | 797 | |
| 798 | 798 | if (is_array($this->in_reply_to)) { |
| 799 | - foreach($this->in_reply_to as $in_reply_to) { |
|
| 799 | + foreach ($this->in_reply_to as $in_reply_to) { |
|
| 800 | 800 | $this->fetchThreadByMessageId($thread, $in_reply_to, $folder, $folder, $sent_folder); |
| 801 | 801 | $this->fetchThreadByMessageId($thread, $in_reply_to, $sent_folder, $folder, $sent_folder); |
| 802 | 802 | } |
@@ -817,7 +817,7 @@ discard block |
||
| 817 | 817 | * @throws Exceptions\GetMessagesFailedException |
| 818 | 818 | * @throws Exceptions\RuntimeException |
| 819 | 819 | */ |
| 820 | - protected function fetchThreadByInReplyTo(&$thread, $in_reply_to, $primary_folder, $secondary_folder, $sent_folder){ |
|
| 820 | + protected function fetchThreadByInReplyTo(&$thread, $in_reply_to, $primary_folder, $secondary_folder, $sent_folder) { |
|
| 821 | 821 | $primary_folder->query()->inReplyTo($in_reply_to) |
| 822 | 822 | ->setFetchBody($this->getFetchBodyOption()) |
| 823 | 823 | ->leaveUnread()->get()->each(function($message) use(&$thread, $secondary_folder, $sent_folder){ |
@@ -838,7 +838,7 @@ discard block |
||
| 838 | 838 | * @throws Exceptions\GetMessagesFailedException |
| 839 | 839 | * @throws Exceptions\RuntimeException |
| 840 | 840 | */ |
| 841 | - protected function fetchThreadByMessageId(&$thread, $message_id, $primary_folder, $secondary_folder, $sent_folder){ |
|
| 841 | + protected function fetchThreadByMessageId(&$thread, $message_id, $primary_folder, $secondary_folder, $sent_folder) { |
|
| 842 | 842 | $primary_folder->query()->messageId($message_id) |
| 843 | 843 | ->setFetchBody($this->getFetchBodyOption()) |
| 844 | 844 | ->leaveUnread()->get()->each(function($message) use(&$thread, $secondary_folder, $sent_folder){ |
@@ -934,14 +934,14 @@ discard block |
||
| 934 | 934 | * @throws MessageFlagException |
| 935 | 935 | * @throws MessageHeaderFetchingException |
| 936 | 936 | */ |
| 937 | - protected function fetchNewMail($folder, $next_uid, $event, $expunge){ |
|
| 938 | - if($expunge) $this->client->expunge(); |
|
| 937 | + protected function fetchNewMail($folder, $next_uid, $event, $expunge) { |
|
| 938 | + if ($expunge) $this->client->expunge(); |
|
| 939 | 939 | |
| 940 | 940 | $this->client->openFolder($folder->path); |
| 941 | 941 | |
| 942 | 942 | if ($this->sequence === IMAP::ST_UID) { |
| 943 | 943 | $sequence_id = $next_uid; |
| 944 | - }else{ |
|
| 944 | + }else { |
|
| 945 | 945 | $sequence_id = $this->client->getConnection()->getMessageNumber($next_uid); |
| 946 | 946 | } |
| 947 | 947 | |
@@ -966,11 +966,11 @@ discard block |
||
| 966 | 966 | */ |
| 967 | 967 | public function delete($expunge = true, $trash_path = null, $force_move = false) { |
| 968 | 968 | $status = $this->setFlag("Deleted"); |
| 969 | - if($force_move) { |
|
| 970 | - $trash_path = $trash_path === null ? $this->config["common_folders"]["trash"]: $trash_path; |
|
| 969 | + if ($force_move) { |
|
| 970 | + $trash_path = $trash_path === null ? $this->config["common_folders"]["trash"] : $trash_path; |
|
| 971 | 971 | $status = $this->move($trash_path); |
| 972 | 972 | } |
| 973 | - if($expunge) $this->client->expunge(); |
|
| 973 | + if ($expunge) $this->client->expunge(); |
|
| 974 | 974 | |
| 975 | 975 | $event = $this->getEvent("message", "deleted"); |
| 976 | 976 | $event::dispatch($this); |
@@ -990,7 +990,7 @@ discard block |
||
| 990 | 990 | */ |
| 991 | 991 | public function restore($expunge = true) { |
| 992 | 992 | $status = $this->unsetFlag("Deleted"); |
| 993 | - if($expunge) $this->client->expunge(); |
|
| 993 | + if ($expunge) $this->client->expunge(); |
|
| 994 | 994 | |
| 995 | 995 | $event = $this->getEvent("message", "restored"); |
| 996 | 996 | $event::dispatch($this); |
@@ -1095,7 +1095,7 @@ discard block |
||
| 1095 | 1095 | * |
| 1096 | 1096 | * @return AttachmentCollection |
| 1097 | 1097 | */ |
| 1098 | - public function attachments(){ |
|
| 1098 | + public function attachments() { |
|
| 1099 | 1099 | return $this->getAttachments(); |
| 1100 | 1100 | } |
| 1101 | 1101 | |
@@ -1193,7 +1193,7 @@ discard block |
||
| 1193 | 1193 | * |
| 1194 | 1194 | * @return FlagCollection |
| 1195 | 1195 | */ |
| 1196 | - public function flags(){ |
|
| 1196 | + public function flags() { |
|
| 1197 | 1197 | return $this->getFlags(); |
| 1198 | 1198 | } |
| 1199 | 1199 | |
@@ -1202,7 +1202,7 @@ discard block |
||
| 1202 | 1202 | * |
| 1203 | 1203 | * @return Structure|null |
| 1204 | 1204 | */ |
| 1205 | - public function getStructure(){ |
|
| 1205 | + public function getStructure() { |
|
| 1206 | 1206 | return $this->structure; |
| 1207 | 1207 | } |
| 1208 | 1208 | |
@@ -1228,7 +1228,7 @@ discard block |
||
| 1228 | 1228 | * |
| 1229 | 1229 | * @return array |
| 1230 | 1230 | */ |
| 1231 | - public function getAttributes(){ |
|
| 1231 | + public function getAttributes() { |
|
| 1232 | 1232 | return array_merge($this->attributes, $this->header->getAttributes()); |
| 1233 | 1233 | } |
| 1234 | 1234 | |
@@ -1238,8 +1238,8 @@ discard block |
||
| 1238 | 1238 | * |
| 1239 | 1239 | * @return $this |
| 1240 | 1240 | */ |
| 1241 | - public function setMask($mask){ |
|
| 1242 | - if(class_exists($mask)){ |
|
| 1241 | + public function setMask($mask) { |
|
| 1242 | + if (class_exists($mask)) { |
|
| 1243 | 1243 | $this->mask = $mask; |
| 1244 | 1244 | } |
| 1245 | 1245 | |
@@ -1251,7 +1251,7 @@ discard block |
||
| 1251 | 1251 | * |
| 1252 | 1252 | * @return string |
| 1253 | 1253 | */ |
| 1254 | - public function getMask(){ |
|
| 1254 | + public function getMask() { |
|
| 1255 | 1255 | return $this->mask; |
| 1256 | 1256 | } |
| 1257 | 1257 | |
@@ -1262,9 +1262,9 @@ discard block |
||
| 1262 | 1262 | * @return mixed |
| 1263 | 1263 | * @throws MaskNotFoundException |
| 1264 | 1264 | */ |
| 1265 | - public function mask($mask = null){ |
|
| 1265 | + public function mask($mask = null) { |
|
| 1266 | 1266 | $mask = $mask !== null ? $mask : $this->mask; |
| 1267 | - if(class_exists($mask)){ |
|
| 1267 | + if (class_exists($mask)) { |
|
| 1268 | 1268 | return new $mask($this); |
| 1269 | 1269 | } |
| 1270 | 1270 | |
@@ -1276,7 +1276,7 @@ discard block |
||
| 1276 | 1276 | * |
| 1277 | 1277 | * @return string |
| 1278 | 1278 | */ |
| 1279 | - public function getFolderPath(){ |
|
| 1279 | + public function getFolderPath() { |
|
| 1280 | 1280 | return $this->folder_path; |
| 1281 | 1281 | } |
| 1282 | 1282 | |
@@ -1286,7 +1286,7 @@ discard block |
||
| 1286 | 1286 | * |
| 1287 | 1287 | * @return $this |
| 1288 | 1288 | */ |
| 1289 | - public function setFolderPath($folder_path){ |
|
| 1289 | + public function setFolderPath($folder_path) { |
|
| 1290 | 1290 | $this->folder_path = $folder_path; |
| 1291 | 1291 | |
| 1292 | 1292 | return $this; |
@@ -1298,7 +1298,7 @@ discard block |
||
| 1298 | 1298 | * |
| 1299 | 1299 | * @return $this |
| 1300 | 1300 | */ |
| 1301 | - public function setConfig($config){ |
|
| 1301 | + public function setConfig($config) { |
|
| 1302 | 1302 | $this->config = $config; |
| 1303 | 1303 | |
| 1304 | 1304 | return $this; |
@@ -1310,7 +1310,7 @@ discard block |
||
| 1310 | 1310 | * |
| 1311 | 1311 | * @return $this |
| 1312 | 1312 | */ |
| 1313 | - public function setAvailableFlags($available_flags){ |
|
| 1313 | + public function setAvailableFlags($available_flags) { |
|
| 1314 | 1314 | $this->available_flags = $available_flags; |
| 1315 | 1315 | |
| 1316 | 1316 | return $this; |
@@ -1322,7 +1322,7 @@ discard block |
||
| 1322 | 1322 | * |
| 1323 | 1323 | * @return $this |
| 1324 | 1324 | */ |
| 1325 | - public function setAttachments($attachments){ |
|
| 1325 | + public function setAttachments($attachments) { |
|
| 1326 | 1326 | $this->attachments = $attachments; |
| 1327 | 1327 | |
| 1328 | 1328 | return $this; |
@@ -1334,7 +1334,7 @@ discard block |
||
| 1334 | 1334 | * |
| 1335 | 1335 | * @return $this |
| 1336 | 1336 | */ |
| 1337 | - public function setFlags($flags){ |
|
| 1337 | + public function setFlags($flags) { |
|
| 1338 | 1338 | $this->flags = $flags; |
| 1339 | 1339 | |
| 1340 | 1340 | return $this; |
@@ -1348,7 +1348,7 @@ discard block |
||
| 1348 | 1348 | * @throws Exceptions\RuntimeException |
| 1349 | 1349 | * @throws Exceptions\ConnectionFailedException |
| 1350 | 1350 | */ |
| 1351 | - public function setClient($client){ |
|
| 1351 | + public function setClient($client) { |
|
| 1352 | 1352 | $this->client = $client; |
| 1353 | 1353 | $this->client->openFolder($this->folder_path); |
| 1354 | 1354 | |
@@ -1363,7 +1363,7 @@ discard block |
||
| 1363 | 1363 | * @throws Exceptions\MessageNotFoundException |
| 1364 | 1364 | * @throws Exceptions\ConnectionFailedException |
| 1365 | 1365 | */ |
| 1366 | - public function setUid($uid){ |
|
| 1366 | + public function setUid($uid) { |
|
| 1367 | 1367 | $this->uid = $uid; |
| 1368 | 1368 | $this->msgn = $this->client->getConnection()->getMessageNumber($this->uid); |
| 1369 | 1369 | $this->msglist = null; |
@@ -1380,7 +1380,7 @@ discard block |
||
| 1380 | 1380 | * @throws Exceptions\MessageNotFoundException |
| 1381 | 1381 | * @throws Exceptions\ConnectionFailedException |
| 1382 | 1382 | */ |
| 1383 | - public function setMsgn($msgn, $msglist = null){ |
|
| 1383 | + public function setMsgn($msgn, $msglist = null) { |
|
| 1384 | 1384 | $this->msgn = $msgn; |
| 1385 | 1385 | $this->msglist = $msglist; |
| 1386 | 1386 | $this->uid = $this->client->getConnection()->getUid($this->msgn); |
@@ -1393,7 +1393,7 @@ discard block |
||
| 1393 | 1393 | * |
| 1394 | 1394 | * @return int |
| 1395 | 1395 | */ |
| 1396 | - public function getSequence(){ |
|
| 1396 | + public function getSequence() { |
|
| 1397 | 1397 | return $this->sequence; |
| 1398 | 1398 | } |
| 1399 | 1399 | |
@@ -1402,7 +1402,7 @@ discard block |
||
| 1402 | 1402 | * |
| 1403 | 1403 | * @return int |
| 1404 | 1404 | */ |
| 1405 | - public function getSequenceId(){ |
|
| 1405 | + public function getSequenceId() { |
|
| 1406 | 1406 | return $this->sequence === IMAP::ST_UID ? $this->uid : $this->msgn; |
| 1407 | 1407 | } |
| 1408 | 1408 | |
@@ -1414,11 +1414,11 @@ discard block |
||
| 1414 | 1414 | * @throws Exceptions\ConnectionFailedException |
| 1415 | 1415 | * @throws Exceptions\MessageNotFoundException |
| 1416 | 1416 | */ |
| 1417 | - public function setSequenceId($uid, $msglist = null){ |
|
| 1417 | + public function setSequenceId($uid, $msglist = null) { |
|
| 1418 | 1418 | if ($this->getSequence() === IMAP::ST_UID) { |
| 1419 | 1419 | $this->setUid($uid); |
| 1420 | 1420 | $this->setMsglist($msglist); |
| 1421 | - }else{ |
|
| 1421 | + }else { |
|
| 1422 | 1422 | $this->setMsgn($uid, $msglist); |
| 1423 | 1423 | } |
| 1424 | 1424 | } |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | if(strtolower(substr($method, 0, 3)) === 'get') { |
| 301 | 301 | $name = Str::snake(substr($method, 3)); |
| 302 | 302 | return $this->get($name); |
| 303 | - }elseif (strtolower(substr($method, 0, 3)) === 'set') { |
|
| 303 | + } elseif (strtolower(substr($method, 0, 3)) === 'set') { |
|
| 304 | 304 | $name = Str::snake(substr($method, 3)); |
| 305 | 305 | |
| 306 | 306 | if(in_array($name, array_keys($this->attributes))) { |
@@ -506,7 +506,7 @@ discard block |
||
| 506 | 506 | if ($this->getFlags()->get("seen") == null) { |
| 507 | 507 | $this->unsetFlag("Seen"); |
| 508 | 508 | } |
| 509 | - }elseif ($this->getFlags()->get("seen") != null) { |
|
| 509 | + } elseif ($this->getFlags()->get("seen") != null) { |
|
| 510 | 510 | $this->setFlag("Seen"); |
| 511 | 511 | } |
| 512 | 512 | } |
@@ -550,7 +550,7 @@ discard block |
||
| 550 | 550 | private function fetchPart(Part $part) { |
| 551 | 551 | if ($part->isAttachment()) { |
| 552 | 552 | $this->fetchAttachment($part); |
| 553 | - }else{ |
|
| 553 | + } else{ |
|
| 554 | 554 | $encoding = $this->getEncoding($part); |
| 555 | 555 | |
| 556 | 556 | $content = $this->decodeString($part->content, $part->encoding); |
@@ -575,7 +575,7 @@ discard block |
||
| 575 | 575 | |
| 576 | 576 | if (isset($this->bodies[$subtype])) { |
| 577 | 577 | $this->bodies[$subtype] .= "\n".$content; |
| 578 | - }else{ |
|
| 578 | + } else{ |
|
| 579 | 579 | $this->bodies[$subtype] = $content; |
| 580 | 580 | } |
| 581 | 581 | } |
@@ -746,9 +746,9 @@ discard block |
||
| 746 | 746 | return EncodingAliases::get($parameter->value); |
| 747 | 747 | } |
| 748 | 748 | } |
| 749 | - }elseif (property_exists($structure, 'charset')){ |
|
| 749 | + } elseif (property_exists($structure, 'charset')){ |
|
| 750 | 750 | return EncodingAliases::get($structure->charset); |
| 751 | - }elseif (is_string($structure) === true){ |
|
| 751 | + } elseif (is_string($structure) === true){ |
|
| 752 | 752 | return mb_detect_encoding($structure); |
| 753 | 753 | } |
| 754 | 754 | |
@@ -935,13 +935,15 @@ discard block |
||
| 935 | 935 | * @throws MessageHeaderFetchingException |
| 936 | 936 | */ |
| 937 | 937 | protected function fetchNewMail($folder, $next_uid, $event, $expunge){ |
| 938 | - if($expunge) $this->client->expunge(); |
|
| 938 | + if($expunge) { |
|
| 939 | + $this->client->expunge(); |
|
| 940 | + } |
|
| 939 | 941 | |
| 940 | 942 | $this->client->openFolder($folder->path); |
| 941 | 943 | |
| 942 | 944 | if ($this->sequence === IMAP::ST_UID) { |
| 943 | 945 | $sequence_id = $next_uid; |
| 944 | - }else{ |
|
| 946 | + } else{ |
|
| 945 | 947 | $sequence_id = $this->client->getConnection()->getMessageNumber($next_uid); |
| 946 | 948 | } |
| 947 | 949 | |
@@ -970,7 +972,9 @@ discard block |
||
| 970 | 972 | $trash_path = $trash_path === null ? $this->config["common_folders"]["trash"]: $trash_path; |
| 971 | 973 | $status = $this->move($trash_path); |
| 972 | 974 | } |
| 973 | - if($expunge) $this->client->expunge(); |
|
| 975 | + if($expunge) { |
|
| 976 | + $this->client->expunge(); |
|
| 977 | + } |
|
| 974 | 978 | |
| 975 | 979 | $event = $this->getEvent("message", "deleted"); |
| 976 | 980 | $event::dispatch($this); |
@@ -990,7 +994,9 @@ discard block |
||
| 990 | 994 | */ |
| 991 | 995 | public function restore($expunge = true) { |
| 992 | 996 | $status = $this->unsetFlag("Deleted"); |
| 993 | - if($expunge) $this->client->expunge(); |
|
| 997 | + if($expunge) { |
|
| 998 | + $this->client->expunge(); |
|
| 999 | + } |
|
| 994 | 1000 | |
| 995 | 1001 | $event = $this->getEvent("message", "restored"); |
| 996 | 1002 | $event::dispatch($this); |
@@ -1418,7 +1424,7 @@ discard block |
||
| 1418 | 1424 | if ($this->getSequence() === IMAP::ST_UID) { |
| 1419 | 1425 | $this->setUid($uid); |
| 1420 | 1426 | $this->setMsglist($msglist); |
| 1421 | - }else{ |
|
| 1427 | + } else{ |
|
| 1422 | 1428 | $this->setMsgn($uid, $msglist); |
| 1423 | 1429 | } |
| 1424 | 1430 | } |
@@ -85,8 +85,8 @@ discard block |
||
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | if (strpos(strtolower($name), "where") === false) { |
| 88 | - $method = 'where' . ucfirst($name); |
|
| 89 | - } else { |
|
| 88 | + $method = 'where'.ucfirst($name); |
|
| 89 | + }else { |
|
| 90 | 90 | $method = lcfirst($name); |
| 91 | 91 | } |
| 92 | 92 | |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | return call_user_func_array([$that, $method], $arguments); |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | - throw new MethodNotFoundException("Method " . self::class . '::' . $method . '() is not supported'); |
|
| 97 | + throw new MethodNotFoundException("Method ".self::class.'::'.$method.'() is not supported'); |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | /** |
@@ -137,11 +137,11 @@ discard block |
||
| 137 | 137 | foreach ($criteria as $key => $value) { |
| 138 | 138 | if (is_numeric($key)) { |
| 139 | 139 | $this->where($value); |
| 140 | - }else{ |
|
| 140 | + }else { |
|
| 141 | 141 | $this->where($key, $value); |
| 142 | 142 | } |
| 143 | 143 | } |
| 144 | - } else { |
|
| 144 | + }else { |
|
| 145 | 145 | $this->push_search_criteria($criteria, $value); |
| 146 | 146 | } |
| 147 | 147 | |
@@ -155,13 +155,13 @@ discard block |
||
| 155 | 155 | * |
| 156 | 156 | * @throws InvalidWhereQueryCriteriaException |
| 157 | 157 | */ |
| 158 | - protected function push_search_criteria($criteria, $value){ |
|
| 158 | + protected function push_search_criteria($criteria, $value) { |
|
| 159 | 159 | $criteria = $this->validate_criteria($criteria); |
| 160 | 160 | $value = $this->parse_value($value); |
| 161 | 161 | |
| 162 | 162 | if ($value === null || $value === '') { |
| 163 | 163 | $this->query->push([$criteria]); |
| 164 | - } else { |
|
| 164 | + }else { |
|
| 165 | 165 | $this->query->push([$criteria, $value]); |
| 166 | 166 | } |
| 167 | 167 | } |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | foreach ($criteria as $key => $value) { |
| 138 | 138 | if (is_numeric($key)) { |
| 139 | 139 | $this->where($value); |
| 140 | - }else{ |
|
| 140 | + } else{ |
|
| 141 | 141 | $this->where($key, $value); |
| 142 | 142 | } |
| 143 | 143 | } |
@@ -173,7 +173,9 @@ discard block |
||
| 173 | 173 | */ |
| 174 | 174 | public function orWhere(Closure $closure = null) { |
| 175 | 175 | $this->query->push(['OR']); |
| 176 | - if ($closure !== null) $closure($this); |
|
| 176 | + if ($closure !== null) { |
|
| 177 | + $closure($this); |
|
| 178 | + } |
|
| 177 | 179 | |
| 178 | 180 | return $this; |
| 179 | 181 | } |
@@ -185,7 +187,9 @@ discard block |
||
| 185 | 187 | */ |
| 186 | 188 | public function andWhere(Closure $closure = null) { |
| 187 | 189 | $this->query->push(['AND']); |
| 188 | - if ($closure !== null) $closure($this); |
|
| 190 | + if ($closure !== null) { |
|
| 191 | + $closure($this); |
|
| 192 | + } |
|
| 189 | 193 | |
| 190 | 194 | return $this; |
| 191 | 195 | } |