@@ -305,7 +305,7 @@ discard block |
||
| 305 | 305 | if(strtolower(substr($method, 0, 3)) === 'get') { |
| 306 | 306 | $name = Str::snake(substr($method, 3)); |
| 307 | 307 | return $this->get($name); |
| 308 | - }elseif (strtolower(substr($method, 0, 3)) === 'set') { |
|
| 308 | + } elseif (strtolower(substr($method, 0, 3)) === 'set') { |
|
| 309 | 309 | $name = Str::snake(substr($method, 3)); |
| 310 | 310 | |
| 311 | 311 | if(in_array($name, array_keys($this->attributes))) { |
@@ -511,7 +511,7 @@ discard block |
||
| 511 | 511 | if ($this->getFlags()->get("seen") == null) { |
| 512 | 512 | $this->unsetFlag("Seen"); |
| 513 | 513 | } |
| 514 | - }elseif ($this->getFlags()->get("seen") != null) { |
|
| 514 | + } elseif ($this->getFlags()->get("seen") != null) { |
|
| 515 | 515 | $this->setFlag("Seen"); |
| 516 | 516 | } |
| 517 | 517 | } |
@@ -555,7 +555,7 @@ discard block |
||
| 555 | 555 | private function fetchPart(Part $part) { |
| 556 | 556 | if ($part->isAttachment()) { |
| 557 | 557 | $this->fetchAttachment($part); |
| 558 | - }else{ |
|
| 558 | + } else{ |
|
| 559 | 559 | $encoding = $this->getEncoding($part); |
| 560 | 560 | |
| 561 | 561 | $content = $this->decodeString($part->content, $part->encoding); |
@@ -580,7 +580,7 @@ discard block |
||
| 580 | 580 | |
| 581 | 581 | if (isset($this->bodies[$subtype])) { |
| 582 | 582 | $this->bodies[$subtype] .= "\n".$content; |
| 583 | - }else{ |
|
| 583 | + } else{ |
|
| 584 | 584 | $this->bodies[$subtype] = $content; |
| 585 | 585 | } |
| 586 | 586 | } |
@@ -751,9 +751,9 @@ discard block |
||
| 751 | 751 | return EncodingAliases::get($parameter->value); |
| 752 | 752 | } |
| 753 | 753 | } |
| 754 | - }elseif (property_exists($structure, 'charset')){ |
|
| 754 | + } elseif (property_exists($structure, 'charset')){ |
|
| 755 | 755 | return EncodingAliases::get($structure->charset); |
| 756 | - }elseif (is_string($structure) === true){ |
|
| 756 | + } elseif (is_string($structure) === true){ |
|
| 757 | 757 | return mb_detect_encoding($structure); |
| 758 | 758 | } |
| 759 | 759 | |
@@ -937,13 +937,15 @@ discard block |
||
| 937 | 937 | * @throws MessageHeaderFetchingException |
| 938 | 938 | */ |
| 939 | 939 | protected function fetchNewMail($folder, $next_uid, $event, $expunge){ |
| 940 | - if($expunge) $this->client->expunge(); |
|
| 940 | + if($expunge) { |
|
| 941 | + $this->client->expunge(); |
|
| 942 | + } |
|
| 941 | 943 | |
| 942 | 944 | $this->client->openFolder($folder->path); |
| 943 | 945 | |
| 944 | 946 | if ($this->sequence === IMAP::ST_UID) { |
| 945 | 947 | $sequence_id = $next_uid; |
| 946 | - }else{ |
|
| 948 | + } else{ |
|
| 947 | 949 | $sequence_id = $this->client->getConnection()->getMessageNumber($next_uid); |
| 948 | 950 | } |
| 949 | 951 | |
@@ -966,7 +968,9 @@ discard block |
||
| 966 | 968 | */ |
| 967 | 969 | public function delete($expunge = true) { |
| 968 | 970 | $status = $this->setFlag("Deleted"); |
| 969 | - if($expunge) $this->client->expunge(); |
|
| 971 | + if($expunge) { |
|
| 972 | + $this->client->expunge(); |
|
| 973 | + } |
|
| 970 | 974 | |
| 971 | 975 | $event = $this->getEvent("message", "deleted"); |
| 972 | 976 | $event::dispatch($this); |
@@ -986,7 +990,9 @@ discard block |
||
| 986 | 990 | */ |
| 987 | 991 | public function restore($expunge = true) { |
| 988 | 992 | $status = $this->unsetFlag("Deleted"); |
| 989 | - if($expunge) $this->client->expunge(); |
|
| 993 | + if($expunge) { |
|
| 994 | + $this->client->expunge(); |
|
| 995 | + } |
|
| 990 | 996 | |
| 991 | 997 | $event = $this->getEvent("message", "restored"); |
| 992 | 998 | $event::dispatch($this); |
@@ -1405,7 +1411,7 @@ discard block |
||
| 1405 | 1411 | if ($this->getSequence() === IMAP::ST_UID) { |
| 1406 | 1412 | $this->setUid($uid); |
| 1407 | 1413 | $this->setMsglist($msglist); |
| 1408 | - }else{ |
|
| 1414 | + } else{ |
|
| 1409 | 1415 | $this->setMsgn($uid, $msglist); |
| 1410 | 1416 | } |
| 1411 | 1417 | } |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | public function __construct($uid, $msglist, Client $client, $fetch_options = null, $fetch_body = false, $fetch_flags = false, $sequence = null) { |
| 205 | 205 | |
| 206 | 206 | $default_mask = $client->getDefaultMessageMask(); |
| 207 | - if($default_mask != null) { |
|
| 207 | + if ($default_mask != null) { |
|
| 208 | 208 | $this->mask = $default_mask; |
| 209 | 209 | } |
| 210 | 210 | $this->events["message"] = $client->getDefaultEvents("message"); |
@@ -263,13 +263,13 @@ discard block |
||
| 263 | 263 | * @throws MessageFlagException |
| 264 | 264 | * @throws Exceptions\RuntimeException |
| 265 | 265 | */ |
| 266 | - public static function make($uid, $msglist, Client $client, $raw_header, $raw_body, $raw_flags, $fetch_options = null, $sequence = null){ |
|
| 266 | + public static function make($uid, $msglist, Client $client, $raw_header, $raw_body, $raw_flags, $fetch_options = null, $sequence = null) { |
|
| 267 | 267 | $reflection = new ReflectionClass(self::class); |
| 268 | 268 | /** @var self $instance */ |
| 269 | 269 | $instance = $reflection->newInstanceWithoutConstructor(); |
| 270 | 270 | |
| 271 | 271 | $default_mask = $client->getDefaultMessageMask(); |
| 272 | - if($default_mask != null) { |
|
| 272 | + if ($default_mask != null) { |
|
| 273 | 273 | $instance->setMask($default_mask); |
| 274 | 274 | } |
| 275 | 275 | $instance->setEvents([ |
@@ -304,13 +304,13 @@ discard block |
||
| 304 | 304 | * @throws MethodNotFoundException |
| 305 | 305 | */ |
| 306 | 306 | public function __call($method, $arguments) { |
| 307 | - if(strtolower(substr($method, 0, 3)) === 'get') { |
|
| 307 | + if (strtolower(substr($method, 0, 3)) === 'get') { |
|
| 308 | 308 | $name = Str::snake(substr($method, 3)); |
| 309 | 309 | return $this->get($name); |
| 310 | 310 | }elseif (strtolower(substr($method, 0, 3)) === 'set') { |
| 311 | 311 | $name = Str::snake(substr($method, 3)); |
| 312 | 312 | |
| 313 | - if(in_array($name, array_keys($this->attributes))) { |
|
| 313 | + if (in_array($name, array_keys($this->attributes))) { |
|
| 314 | 314 | return $this->__set($name, array_pop($arguments)); |
| 315 | 315 | } |
| 316 | 316 | |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | * @return mixed|null |
| 350 | 350 | */ |
| 351 | 351 | public function get($name) { |
| 352 | - if(isset($this->attributes[$name])) { |
|
| 352 | + if (isset($this->attributes[$name])) { |
|
| 353 | 353 | return $this->attributes[$name]; |
| 354 | 354 | } |
| 355 | 355 | |
@@ -423,7 +423,7 @@ discard block |
||
| 423 | 423 | * |
| 424 | 424 | * @throws InvalidMessageDateException |
| 425 | 425 | */ |
| 426 | - public function parseRawHeader($raw_header){ |
|
| 426 | + public function parseRawHeader($raw_header) { |
|
| 427 | 427 | $this->header = new Header($raw_header); |
| 428 | 428 | } |
| 429 | 429 | |
@@ -434,8 +434,8 @@ discard block |
||
| 434 | 434 | public function parseRawFlags($raw_flags) { |
| 435 | 435 | $this->flags = FlagCollection::make([]); |
| 436 | 436 | |
| 437 | - foreach($raw_flags as $flag) { |
|
| 438 | - if (strpos($flag, "\\") === 0){ |
|
| 437 | + foreach ($raw_flags as $flag) { |
|
| 438 | + if (strpos($flag, "\\") === 0) { |
|
| 439 | 439 | $flag = substr($flag, 1); |
| 440 | 440 | } |
| 441 | 441 | $flag_key = strtolower($flag); |
@@ -508,7 +508,7 @@ discard block |
||
| 508 | 508 | * @throws MessageFlagException |
| 509 | 509 | * @throws Exceptions\RuntimeException |
| 510 | 510 | */ |
| 511 | - public function peek(){ |
|
| 511 | + public function peek() { |
|
| 512 | 512 | if ($this->fetch_options == IMAP::FT_PEEK) { |
| 513 | 513 | if ($this->getFlags()->get("seen") == null) { |
| 514 | 514 | $this->unsetFlag("Seen"); |
@@ -557,7 +557,7 @@ discard block |
||
| 557 | 557 | private function fetchPart(Part $part) { |
| 558 | 558 | if ($part->isAttachment()) { |
| 559 | 559 | $this->fetchAttachment($part); |
| 560 | - }else{ |
|
| 560 | + }else { |
|
| 561 | 561 | $encoding = $this->getEncoding($part); |
| 562 | 562 | |
| 563 | 563 | $content = $this->decodeString($part->content, $part->encoding); |
@@ -582,7 +582,7 @@ discard block |
||
| 582 | 582 | |
| 583 | 583 | if (isset($this->bodies[$subtype])) { |
| 584 | 584 | $this->bodies[$subtype] .= "\n".$content; |
| 585 | - }else{ |
|
| 585 | + }else { |
|
| 586 | 586 | $this->bodies[$subtype] = $content; |
| 587 | 587 | } |
| 588 | 588 | } |
@@ -598,7 +598,7 @@ discard block |
||
| 598 | 598 | if ($oAttachment->getName() !== null && $oAttachment->getSize() > 0) { |
| 599 | 599 | if ($oAttachment->getId() !== null) { |
| 600 | 600 | $this->attachments->put($oAttachment->getId(), $oAttachment); |
| 601 | - } else { |
|
| 601 | + }else { |
|
| 602 | 602 | $this->attachments->push($oAttachment); |
| 603 | 603 | } |
| 604 | 604 | } |
@@ -732,7 +732,7 @@ discard block |
||
| 732 | 732 | |
| 733 | 733 | if (function_exists('iconv') && $from != 'UTF-7' && $to != 'UTF-7') { |
| 734 | 734 | return @iconv($from, $to.'//IGNORE', $str); |
| 735 | - } else { |
|
| 735 | + }else { |
|
| 736 | 736 | if (!$from) { |
| 737 | 737 | return mb_convert_encoding($str, $to); |
| 738 | 738 | } |
@@ -753,9 +753,9 @@ discard block |
||
| 753 | 753 | return EncodingAliases::get($parameter->value); |
| 754 | 754 | } |
| 755 | 755 | } |
| 756 | - }elseif (property_exists($structure, 'charset')){ |
|
| 756 | + }elseif (property_exists($structure, 'charset')) { |
|
| 757 | 757 | return EncodingAliases::get($structure->charset); |
| 758 | - }elseif (is_string($structure) === true){ |
|
| 758 | + }elseif (is_string($structure) === true) { |
|
| 759 | 759 | return mb_detect_encoding($structure); |
| 760 | 760 | } |
| 761 | 761 | |
@@ -770,7 +770,7 @@ discard block |
||
| 770 | 770 | * @throws Exceptions\FolderFetchingException |
| 771 | 771 | * @throws Exceptions\RuntimeException |
| 772 | 772 | */ |
| 773 | - public function getFolder(){ |
|
| 773 | + public function getFolder() { |
|
| 774 | 774 | return $this->client->getFolder($this->folder_path); |
| 775 | 775 | } |
| 776 | 776 | |
@@ -786,13 +786,13 @@ discard block |
||
| 786 | 786 | * @throws Exceptions\GetMessagesFailedException |
| 787 | 787 | * @throws Exceptions\RuntimeException |
| 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 | } |
@@ -803,7 +803,7 @@ discard block |
||
| 803 | 803 | $this->fetchThreadByInReplyTo($thread, $this->message_id, $sent_folder, $folder, $sent_folder); |
| 804 | 804 | |
| 805 | 805 | if (is_array($this->in_reply_to)) { |
| 806 | - foreach($this->in_reply_to as $in_reply_to) { |
|
| 806 | + foreach ($this->in_reply_to as $in_reply_to) { |
|
| 807 | 807 | $this->fetchThreadByMessageId($thread, $in_reply_to, $folder, $folder, $sent_folder); |
| 808 | 808 | $this->fetchThreadByMessageId($thread, $in_reply_to, $sent_folder, $folder, $sent_folder); |
| 809 | 809 | } |
@@ -824,7 +824,7 @@ discard block |
||
| 824 | 824 | * @throws Exceptions\GetMessagesFailedException |
| 825 | 825 | * @throws Exceptions\RuntimeException |
| 826 | 826 | */ |
| 827 | - protected function fetchThreadByInReplyTo(&$thread, $in_reply_to, $primary_folder, $secondary_folder, $sent_folder){ |
|
| 827 | + protected function fetchThreadByInReplyTo(&$thread, $in_reply_to, $primary_folder, $secondary_folder, $sent_folder) { |
|
| 828 | 828 | $primary_folder->query()->inReplyTo($in_reply_to) |
| 829 | 829 | ->setFetchBody($this->getFetchBodyOption()) |
| 830 | 830 | ->leaveUnread()->get()->each(function($message) use(&$thread, $secondary_folder, $sent_folder){ |
@@ -845,7 +845,7 @@ discard block |
||
| 845 | 845 | * @throws Exceptions\GetMessagesFailedException |
| 846 | 846 | * @throws Exceptions\RuntimeException |
| 847 | 847 | */ |
| 848 | - protected function fetchThreadByMessageId(&$thread, $message_id, $primary_folder, $secondary_folder, $sent_folder){ |
|
| 848 | + protected function fetchThreadByMessageId(&$thread, $message_id, $primary_folder, $secondary_folder, $sent_folder) { |
|
| 849 | 849 | $primary_folder->query()->messageId($message_id) |
| 850 | 850 | ->setFetchBody($this->getFetchBodyOption()) |
| 851 | 851 | ->leaveUnread()->get()->each(function($message) use(&$thread, $secondary_folder, $sent_folder){ |
@@ -938,14 +938,14 @@ discard block |
||
| 938 | 938 | * @throws MessageFlagException |
| 939 | 939 | * @throws MessageHeaderFetchingException |
| 940 | 940 | */ |
| 941 | - protected function fetchNewMail($folder, $next_uid, $event, $expunge){ |
|
| 942 | - if($expunge) $this->client->expunge(); |
|
| 941 | + protected function fetchNewMail($folder, $next_uid, $event, $expunge) { |
|
| 942 | + if ($expunge) $this->client->expunge(); |
|
| 943 | 943 | |
| 944 | 944 | $this->client->openFolder($folder->path); |
| 945 | 945 | |
| 946 | 946 | if ($this->sequence === IMAP::ST_UID) { |
| 947 | 947 | $sequence_id = $next_uid; |
| 948 | - }else{ |
|
| 948 | + }else { |
|
| 949 | 949 | $sequence_id = $this->client->getConnection()->getMessageNumber($next_uid); |
| 950 | 950 | } |
| 951 | 951 | |
@@ -968,7 +968,7 @@ discard block |
||
| 968 | 968 | */ |
| 969 | 969 | public function delete($expunge = true) { |
| 970 | 970 | $status = $this->setFlag("Deleted"); |
| 971 | - if($expunge) $this->client->expunge(); |
|
| 971 | + if ($expunge) $this->client->expunge(); |
|
| 972 | 972 | |
| 973 | 973 | $event = $this->getEvent("message", "deleted"); |
| 974 | 974 | $event::dispatch($this); |
@@ -988,7 +988,7 @@ discard block |
||
| 988 | 988 | */ |
| 989 | 989 | public function restore($expunge = true) { |
| 990 | 990 | $status = $this->unsetFlag("Deleted"); |
| 991 | - if($expunge) $this->client->expunge(); |
|
| 991 | + if ($expunge) $this->client->expunge(); |
|
| 992 | 992 | |
| 993 | 993 | $event = $this->getEvent("message", "restored"); |
| 994 | 994 | $event::dispatch($this); |
@@ -1093,7 +1093,7 @@ discard block |
||
| 1093 | 1093 | * |
| 1094 | 1094 | * @return AttachmentCollection |
| 1095 | 1095 | */ |
| 1096 | - public function attachments(){ |
|
| 1096 | + public function attachments() { |
|
| 1097 | 1097 | return $this->getAttachments(); |
| 1098 | 1098 | } |
| 1099 | 1099 | |
@@ -1191,7 +1191,7 @@ discard block |
||
| 1191 | 1191 | * |
| 1192 | 1192 | * @return FlagCollection |
| 1193 | 1193 | */ |
| 1194 | - public function flags(){ |
|
| 1194 | + public function flags() { |
|
| 1195 | 1195 | return $this->getFlags(); |
| 1196 | 1196 | } |
| 1197 | 1197 | |
@@ -1200,7 +1200,7 @@ discard block |
||
| 1200 | 1200 | * |
| 1201 | 1201 | * @return Structure|null |
| 1202 | 1202 | */ |
| 1203 | - public function getStructure(){ |
|
| 1203 | + public function getStructure() { |
|
| 1204 | 1204 | return $this->structure; |
| 1205 | 1205 | } |
| 1206 | 1206 | |
@@ -1226,7 +1226,7 @@ discard block |
||
| 1226 | 1226 | * |
| 1227 | 1227 | * @return array |
| 1228 | 1228 | */ |
| 1229 | - public function getAttributes(){ |
|
| 1229 | + public function getAttributes() { |
|
| 1230 | 1230 | return array_merge($this->attributes, $this->header->getAttributes()); |
| 1231 | 1231 | } |
| 1232 | 1232 | |
@@ -1236,8 +1236,8 @@ discard block |
||
| 1236 | 1236 | * |
| 1237 | 1237 | * @return $this |
| 1238 | 1238 | */ |
| 1239 | - public function setMask($mask){ |
|
| 1240 | - if(class_exists($mask)){ |
|
| 1239 | + public function setMask($mask) { |
|
| 1240 | + if (class_exists($mask)) { |
|
| 1241 | 1241 | $this->mask = $mask; |
| 1242 | 1242 | } |
| 1243 | 1243 | |
@@ -1249,7 +1249,7 @@ discard block |
||
| 1249 | 1249 | * |
| 1250 | 1250 | * @return string |
| 1251 | 1251 | */ |
| 1252 | - public function getMask(){ |
|
| 1252 | + public function getMask() { |
|
| 1253 | 1253 | return $this->mask; |
| 1254 | 1254 | } |
| 1255 | 1255 | |
@@ -1260,9 +1260,9 @@ discard block |
||
| 1260 | 1260 | * @return mixed |
| 1261 | 1261 | * @throws MaskNotFoundException |
| 1262 | 1262 | */ |
| 1263 | - public function mask($mask = null){ |
|
| 1263 | + public function mask($mask = null) { |
|
| 1264 | 1264 | $mask = $mask !== null ? $mask : $this->mask; |
| 1265 | - if(class_exists($mask)){ |
|
| 1265 | + if (class_exists($mask)) { |
|
| 1266 | 1266 | return new $mask($this); |
| 1267 | 1267 | } |
| 1268 | 1268 | |
@@ -1275,7 +1275,7 @@ discard block |
||
| 1275 | 1275 | * |
| 1276 | 1276 | * @return $this |
| 1277 | 1277 | */ |
| 1278 | - public function setFolderPath($folder_path){ |
|
| 1278 | + public function setFolderPath($folder_path) { |
|
| 1279 | 1279 | $this->folder_path = $folder_path; |
| 1280 | 1280 | |
| 1281 | 1281 | return $this; |
@@ -1287,7 +1287,7 @@ discard block |
||
| 1287 | 1287 | * |
| 1288 | 1288 | * @return $this |
| 1289 | 1289 | */ |
| 1290 | - public function setConfig($config){ |
|
| 1290 | + public function setConfig($config) { |
|
| 1291 | 1291 | $this->config = $config; |
| 1292 | 1292 | |
| 1293 | 1293 | return $this; |
@@ -1299,7 +1299,7 @@ discard block |
||
| 1299 | 1299 | * |
| 1300 | 1300 | * @return $this |
| 1301 | 1301 | */ |
| 1302 | - public function setAvailableFlags($available_flags){ |
|
| 1302 | + public function setAvailableFlags($available_flags) { |
|
| 1303 | 1303 | $this->available_flags = $available_flags; |
| 1304 | 1304 | |
| 1305 | 1305 | return $this; |
@@ -1311,7 +1311,7 @@ discard block |
||
| 1311 | 1311 | * |
| 1312 | 1312 | * @return $this |
| 1313 | 1313 | */ |
| 1314 | - public function setAttachments($attachments){ |
|
| 1314 | + public function setAttachments($attachments) { |
|
| 1315 | 1315 | $this->attachments = $attachments; |
| 1316 | 1316 | |
| 1317 | 1317 | return $this; |
@@ -1323,7 +1323,7 @@ discard block |
||
| 1323 | 1323 | * |
| 1324 | 1324 | * @return $this |
| 1325 | 1325 | */ |
| 1326 | - public function setFlags($flags){ |
|
| 1326 | + public function setFlags($flags) { |
|
| 1327 | 1327 | $this->flags = $flags; |
| 1328 | 1328 | |
| 1329 | 1329 | return $this; |
@@ -1337,7 +1337,7 @@ discard block |
||
| 1337 | 1337 | * @throws Exceptions\RuntimeException |
| 1338 | 1338 | * @throws Exceptions\ConnectionFailedException |
| 1339 | 1339 | */ |
| 1340 | - public function setClient($client){ |
|
| 1340 | + public function setClient($client) { |
|
| 1341 | 1341 | $this->client = $client; |
| 1342 | 1342 | $this->client->openFolder($this->folder_path); |
| 1343 | 1343 | |
@@ -1352,7 +1352,7 @@ discard block |
||
| 1352 | 1352 | * @throws Exceptions\RuntimeException |
| 1353 | 1353 | * @return $this |
| 1354 | 1354 | */ |
| 1355 | - public function setUid($uid){ |
|
| 1355 | + public function setUid($uid) { |
|
| 1356 | 1356 | $this->uid = $uid; |
| 1357 | 1357 | $this->msgn = $this->client->getConnection()->getMessageNumber($this->uid); |
| 1358 | 1358 | $this->msglist = null; |
@@ -1369,7 +1369,7 @@ discard block |
||
| 1369 | 1369 | * @throws Exceptions\RuntimeException |
| 1370 | 1370 | * @return $this |
| 1371 | 1371 | */ |
| 1372 | - public function setMsgn($msgn, $msglist = null){ |
|
| 1372 | + public function setMsgn($msgn, $msglist = null) { |
|
| 1373 | 1373 | $this->msgn = $msgn; |
| 1374 | 1374 | $this->msglist = $msglist; |
| 1375 | 1375 | $this->uid = $this->client->getConnection()->getUid($this->msgn); |
@@ -1382,7 +1382,7 @@ discard block |
||
| 1382 | 1382 | * |
| 1383 | 1383 | * @return int |
| 1384 | 1384 | */ |
| 1385 | - public function getSequence(){ |
|
| 1385 | + public function getSequence() { |
|
| 1386 | 1386 | return $this->sequence; |
| 1387 | 1387 | } |
| 1388 | 1388 | |
@@ -1391,7 +1391,7 @@ discard block |
||
| 1391 | 1391 | * |
| 1392 | 1392 | * @return int |
| 1393 | 1393 | */ |
| 1394 | - public function getSequenceId(){ |
|
| 1394 | + public function getSequenceId() { |
|
| 1395 | 1395 | return $this->sequence === IMAP::ST_UID ? $this->uid : $this->msgn; |
| 1396 | 1396 | } |
| 1397 | 1397 | |
@@ -1403,11 +1403,11 @@ discard block |
||
| 1403 | 1403 | * @throws Exceptions\ConnectionFailedException |
| 1404 | 1404 | * @throws Exceptions\RuntimeException |
| 1405 | 1405 | */ |
| 1406 | - public function setSequenceId($uid, $msglist = null){ |
|
| 1406 | + public function setSequenceId($uid, $msglist = null) { |
|
| 1407 | 1407 | if ($this->getSequence() === IMAP::ST_UID) { |
| 1408 | 1408 | $this->setUid($uid); |
| 1409 | 1409 | $this->setMsglist($msglist); |
| 1410 | - }else{ |
|
| 1410 | + }else { |
|
| 1411 | 1411 | $this->setMsgn($uid, $msglist); |
| 1412 | 1412 | } |
| 1413 | 1413 | } |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | * @throws MessageContentFetchingException |
| 78 | 78 | * @throws InvalidMessageDateException |
| 79 | 79 | */ |
| 80 | - protected function parse(){ |
|
| 80 | + protected function parse() { |
|
| 81 | 81 | $this->findContentType(); |
| 82 | 82 | $this->parts = $this->find_parts(); |
| 83 | 83 | } |
@@ -85,12 +85,12 @@ discard block |
||
| 85 | 85 | /** |
| 86 | 86 | * Determine the message content type |
| 87 | 87 | */ |
| 88 | - public function findContentType(){ |
|
| 88 | + public function findContentType() { |
|
| 89 | 89 | $content_type = $this->header->get("content_type"); |
| 90 | 90 | $content_type = (is_array($content_type)) ? implode(' ', $content_type) : $content_type; |
| 91 | - if(stripos($content_type, 'multipart') === 0) { |
|
| 91 | + if (stripos($content_type, 'multipart') === 0) { |
|
| 92 | 92 | $this->type = IMAP::MESSAGE_TYPE_MULTIPART; |
| 93 | - }else{ |
|
| 93 | + }else { |
|
| 94 | 94 | $this->type = IMAP::MESSAGE_TYPE_TEXT; |
| 95 | 95 | } |
| 96 | 96 | } |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | * @return Part[] |
| 104 | 104 | * @throws InvalidMessageDateException |
| 105 | 105 | */ |
| 106 | - private function parsePart($context, $part_number = 0){ |
|
| 106 | + private function parsePart($context, $part_number = 0) { |
|
| 107 | 107 | $body = $context; |
| 108 | 108 | while (($pos = strpos($body, "\r\n")) > 0) { |
| 109 | 109 | $body = substr($body, $pos + 2); |
@@ -126,10 +126,10 @@ discard block |
||
| 126 | 126 | * @return array |
| 127 | 127 | * @throws InvalidMessageDateException |
| 128 | 128 | */ |
| 129 | - private function detectParts($boundary, $context, $part_number = 0){ |
|
| 130 | - $base_parts = explode( $boundary, $context); |
|
| 129 | + private function detectParts($boundary, $context, $part_number = 0) { |
|
| 130 | + $base_parts = explode($boundary, $context); |
|
| 131 | 131 | $final_parts = []; |
| 132 | - foreach($base_parts as $ctx) { |
|
| 132 | + foreach ($base_parts as $ctx) { |
|
| 133 | 133 | $ctx = substr($ctx, 2); |
| 134 | 134 | if ($ctx !== "--" && $ctx != "") { |
| 135 | 135 | $parts = $this->parsePart($ctx, $part_number); |
@@ -150,9 +150,9 @@ discard block |
||
| 150 | 150 | * @throws MessageContentFetchingException |
| 151 | 151 | * @throws InvalidMessageDateException |
| 152 | 152 | */ |
| 153 | - public function find_parts(){ |
|
| 154 | - if($this->type === IMAP::MESSAGE_TYPE_MULTIPART) { |
|
| 155 | - if (($boundary = $this->header->getBoundary()) === null) { |
|
| 153 | + public function find_parts() { |
|
| 154 | + if ($this->type === IMAP::MESSAGE_TYPE_MULTIPART) { |
|
| 155 | + if (($boundary = $this->header->getBoundary()) === null) { |
|
| 156 | 156 | throw new MessageContentFetchingException("no content found", 0); |
| 157 | 157 | } |
| 158 | 158 | |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | * @return string|null |
| 169 | 169 | * @Depricated since version 2.4.4 |
| 170 | 170 | */ |
| 171 | - public function getBoundary(){ |
|
| 171 | + public function getBoundary() { |
|
| 172 | 172 | return $this->header->getBoundary(); |
| 173 | 173 | } |
| 174 | 174 | } |
@@ -90,7 +90,7 @@ |
||
| 90 | 90 | $content_type = (is_array($content_type)) ? implode(' ', $content_type) : $content_type; |
| 91 | 91 | if(stripos($content_type, 'multipart') === 0) { |
| 92 | 92 | $this->type = IMAP::MESSAGE_TYPE_MULTIPART; |
| 93 | - }else{ |
|
| 93 | + } else{ |
|
| 94 | 94 | $this->type = IMAP::MESSAGE_TYPE_TEXT; |
| 95 | 95 | } |
| 96 | 96 | } |
@@ -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 | /** |
@@ -131,13 +131,13 @@ discard block |
||
| 131 | 131 | } |
| 132 | 132 | return $this->where($key, $value); |
| 133 | 133 | } |
| 134 | - } else { |
|
| 134 | + }else { |
|
| 135 | 135 | $criteria = $this->validate_criteria($criteria); |
| 136 | 136 | $value = $this->parse_value($value); |
| 137 | 137 | |
| 138 | 138 | if ($value === null || $value === '') { |
| 139 | 139 | $this->query->push([$criteria]); |
| 140 | - } else { |
|
| 140 | + }else { |
|
| 141 | 141 | $this->query->push([$criteria, $value]); |
| 142 | 142 | } |
| 143 | 143 | } |
@@ -152,7 +152,9 @@ discard block |
||
| 152 | 152 | */ |
| 153 | 153 | public function orWhere(Closure $closure = null) { |
| 154 | 154 | $this->query->push(['OR']); |
| 155 | - if ($closure !== null) $closure($this); |
|
| 155 | + if ($closure !== null) { |
|
| 156 | + $closure($this); |
|
| 157 | + } |
|
| 156 | 158 | |
| 157 | 159 | return $this; |
| 158 | 160 | } |
@@ -164,7 +166,9 @@ discard block |
||
| 164 | 166 | */ |
| 165 | 167 | public function andWhere(Closure $closure = null) { |
| 166 | 168 | $this->query->push(['AND']); |
| 167 | - if ($closure !== null) $closure($this); |
|
| 169 | + if ($closure !== null) { |
|
| 170 | + $closure($this); |
|
| 171 | + } |
|
| 168 | 172 | |
| 169 | 173 | return $this; |
| 170 | 174 | } |