@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | return $this->attributes[$name]; |
250 | 250 | } |
251 | 251 | |
252 | - }elseif (strtolower(substr($method, 0, 3)) === 'set') { |
|
252 | + } elseif (strtolower(substr($method, 0, 3)) === 'set') { |
|
253 | 253 | $name = Str::snake(substr($method, 3)); |
254 | 254 | |
255 | 255 | if(in_array($name, array_keys($this->attributes))) { |
@@ -369,9 +369,9 @@ discard block |
||
369 | 369 | /** @var Attachment $oAttachment */ |
370 | 370 | if(is_callable($replaceImages)) { |
371 | 371 | $body = $replaceImages($body, $oAttachment); |
372 | - }elseif(is_string($replaceImages)) { |
|
372 | + } elseif(is_string($replaceImages)) { |
|
373 | 373 | call_user_func($replaceImages, [$body, $oAttachment]); |
374 | - }else{ |
|
374 | + } else{ |
|
375 | 375 | if ($oAttachment->id && $oAttachment->getImgSrc() != null) { |
376 | 376 | $body = str_replace('cid:'.$oAttachment->id, $oAttachment->getImgSrc(), $body); |
377 | 377 | } |
@@ -402,9 +402,9 @@ discard block |
||
402 | 402 | if (property_exists($header, 'subject')) { |
403 | 403 | if($this->config['decoder']['message']['subject'] === 'utf-8') { |
404 | 404 | $this->subject = \imap_utf8($header->subject); |
405 | - }elseif($this->config['decoder']['message']['subject'] === 'iconv') { |
|
405 | + } elseif($this->config['decoder']['message']['subject'] === 'iconv') { |
|
406 | 406 | $this->subject = iconv_mime_decode($header->subject); |
407 | - }else{ |
|
407 | + } else{ |
|
408 | 408 | $this->subject = mb_decode_mimeheader($header->subject); |
409 | 409 | } |
410 | 410 | } |
@@ -922,7 +922,7 @@ discard block |
||
922 | 922 | return EncodingAliases::get($parameter->value); |
923 | 923 | } |
924 | 924 | } |
925 | - }elseif (is_string($structure) === true){ |
|
925 | + } elseif (is_string($structure) === true){ |
|
926 | 926 | return mb_detect_encoding($structure); |
927 | 927 | } |
928 | 928 | |
@@ -988,7 +988,9 @@ discard block |
||
988 | 988 | */ |
989 | 989 | public function moveToFolder($mailbox = 'INBOX', $expunge = false, $create_folder = true) { |
990 | 990 | |
991 | - if($create_folder) $this->client->createFolder($mailbox, true); |
|
991 | + if($create_folder) { |
|
992 | + $this->client->createFolder($mailbox, true); |
|
993 | + } |
|
992 | 994 | |
993 | 995 | $target_folder = $this->client->getFolder($mailbox); |
994 | 996 | $target_status = $target_folder->getStatus(IMAP::SA_ALL); |
@@ -997,7 +999,9 @@ discard block |
||
997 | 999 | $status = \imap_mail_move($this->client->getConnection(), $this->uid, $mailbox, IMAP::CP_UID); |
998 | 1000 | |
999 | 1001 | if($status === true){ |
1000 | - if($expunge) $this->client->expunge(); |
|
1002 | + if($expunge) { |
|
1003 | + $this->client->expunge(); |
|
1004 | + } |
|
1001 | 1005 | $this->client->openFolder($target_folder->path); |
1002 | 1006 | |
1003 | 1007 | $message = $target_folder->getMessage($target_status->uidnext, null, $this->fetch_options, $this->fetch_body, $this->fetch_attachment, $this->fetch_flags); |
@@ -1019,7 +1023,9 @@ discard block |
||
1019 | 1023 | $this->client->openFolder($this->folder_path); |
1020 | 1024 | |
1021 | 1025 | $status = \imap_delete($this->client->getConnection(), $this->uid, IMAP::FT_UID); |
1022 | - if($expunge) $this->client->expunge(); |
|
1026 | + if($expunge) { |
|
1027 | + $this->client->expunge(); |
|
1028 | + } |
|
1023 | 1029 | MessageDeletedEvent::dispatch($this); |
1024 | 1030 | |
1025 | 1031 | return $status; |
@@ -1036,7 +1042,9 @@ discard block |
||
1036 | 1042 | $this->client->openFolder($this->folder_path); |
1037 | 1043 | |
1038 | 1044 | $status = \imap_undelete($this->client->getConnection(), $this->uid, IMAP::FT_UID); |
1039 | - if($expunge) $this->client->expunge(); |
|
1045 | + if($expunge) { |
|
1046 | + $this->client->expunge(); |
|
1047 | + } |
|
1040 | 1048 | MessageRestoredEvent::dispatch($this); |
1041 | 1049 | |
1042 | 1050 | return $status; |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | public function __construct($uid, $msglist, Client $client, $fetch_options = null, $fetch_body = false, $fetch_attachment = false, $fetch_flags = false) { |
201 | 201 | |
202 | 202 | $default_mask = $client->getDefaultMessageMask(); |
203 | - if($default_mask != null) { |
|
203 | + if ($default_mask != null) { |
|
204 | 204 | $this->mask = $default_mask; |
205 | 205 | } |
206 | 206 | |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | $this->msglist = $msglist; |
220 | 220 | $this->client = $client; |
221 | 221 | |
222 | - $this->uid = ($this->fetch_options == IMAP::FT_UID) ? $uid : $uid; |
|
222 | + $this->uid = ($this->fetch_options == IMAP::FT_UID) ? $uid : $uid; |
|
223 | 223 | $this->msgn = ($this->fetch_options == IMAP::FT_UID) ? \imap_msgno($this->client->getConnection(), $uid) : $uid; |
224 | 224 | |
225 | 225 | $this->parseHeader(); |
@@ -242,17 +242,17 @@ discard block |
||
242 | 242 | * @throws MethodNotFoundException |
243 | 243 | */ |
244 | 244 | public function __call($method, $arguments) { |
245 | - if(strtolower(substr($method, 0, 3)) === 'get') { |
|
245 | + if (strtolower(substr($method, 0, 3)) === 'get') { |
|
246 | 246 | $name = Str::snake(substr($method, 3)); |
247 | 247 | |
248 | - if(in_array($name, array_keys($this->attributes))) { |
|
248 | + if (in_array($name, array_keys($this->attributes))) { |
|
249 | 249 | return $this->attributes[$name]; |
250 | 250 | } |
251 | 251 | |
252 | 252 | }elseif (strtolower(substr($method, 0, 3)) === 'set') { |
253 | 253 | $name = Str::snake(substr($method, 3)); |
254 | 254 | |
255 | - if(in_array($name, array_keys($this->attributes))) { |
|
255 | + if (in_array($name, array_keys($this->attributes))) { |
|
256 | 256 | $this->attributes[$name] = array_pop($arguments); |
257 | 257 | |
258 | 258 | return $this->attributes[$name]; |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | * @return mixed|null |
282 | 282 | */ |
283 | 283 | public function __get($name) { |
284 | - if(isset($this->attributes[$name])) { |
|
284 | + if (isset($this->attributes[$name])) { |
|
285 | 285 | return $this->attributes[$name]; |
286 | 286 | } |
287 | 287 | |
@@ -367,11 +367,11 @@ discard block |
||
367 | 367 | if ($replaceImages !== false) { |
368 | 368 | $this->attachments->each(function($oAttachment) use(&$body, $replaceImages) { |
369 | 369 | /** @var Attachment $oAttachment */ |
370 | - if(is_callable($replaceImages)) { |
|
370 | + if (is_callable($replaceImages)) { |
|
371 | 371 | $body = $replaceImages($body, $oAttachment); |
372 | - }elseif(is_string($replaceImages)) { |
|
372 | + }elseif (is_string($replaceImages)) { |
|
373 | 373 | call_user_func($replaceImages, [$body, $oAttachment]); |
374 | - }else{ |
|
374 | + } else { |
|
375 | 375 | if ($oAttachment->id && $oAttachment->getImgSrc() != null) { |
376 | 376 | $body = str_replace('cid:'.$oAttachment->id, $oAttachment->getImgSrc(), $body); |
377 | 377 | } |
@@ -400,16 +400,16 @@ discard block |
||
400 | 400 | } |
401 | 401 | |
402 | 402 | if (property_exists($header, 'subject')) { |
403 | - if($this->config['decoder']['message']['subject'] === 'utf-8') { |
|
403 | + if ($this->config['decoder']['message']['subject'] === 'utf-8') { |
|
404 | 404 | $this->subject = \imap_utf8($header->subject); |
405 | - }elseif($this->config['decoder']['message']['subject'] === 'iconv') { |
|
405 | + }elseif ($this->config['decoder']['message']['subject'] === 'iconv') { |
|
406 | 406 | $this->subject = iconv_mime_decode($header->subject); |
407 | - }else{ |
|
407 | + } else { |
|
408 | 408 | $this->subject = mb_decode_mimeheader($header->subject); |
409 | 409 | } |
410 | 410 | } |
411 | 411 | |
412 | - foreach(['from', 'to', 'cc', 'bcc', 'reply_to', 'sender'] as $part){ |
|
412 | + foreach (['from', 'to', 'cc', 'bcc', 'reply_to', 'sender'] as $part) { |
|
413 | 413 | $this->extractHeaderAddressPart($header, $part); |
414 | 414 | } |
415 | 415 | |
@@ -439,9 +439,9 @@ discard block |
||
439 | 439 | * @return int|null |
440 | 440 | */ |
441 | 441 | private function extractPriority($header) { |
442 | - if(preg_match('/x\-priority\:.*([0-9]{1,2})/i', $header, $priority)){ |
|
442 | + if (preg_match('/x\-priority\:.*([0-9]{1,2})/i', $header, $priority)) { |
|
443 | 443 | $priority = isset($priority[1]) ? (int) $priority[1] : 0; |
444 | - switch($priority){ |
|
444 | + switch ($priority) { |
|
445 | 445 | case IMAP::MESSAGE_PRIORITY_HIGHEST; |
446 | 446 | $priority = IMAP::MESSAGE_PRIORITY_HIGHEST; |
447 | 447 | break; |
@@ -492,7 +492,7 @@ discard block |
||
492 | 492 | if (property_exists($header, 'date')) { |
493 | 493 | $date = $header->date; |
494 | 494 | |
495 | - if(preg_match('/\+0580/', $date)) { |
|
495 | + if (preg_match('/\+0580/', $date)) { |
|
496 | 496 | $date = str_replace('+0580', '+0530', $date); |
497 | 497 | } |
498 | 498 | |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | $date = trim(array_pop($array)); |
516 | 516 | break; |
517 | 517 | } |
518 | - try{ |
|
518 | + try { |
|
519 | 519 | $parsed_date = Carbon::parse($date); |
520 | 520 | } catch (\Exception $_e) { |
521 | 521 | throw new InvalidMessageDateException("Invalid message date. ID:".$this->getMessageId(), 1000, $e); |
@@ -538,7 +538,7 @@ discard block |
||
538 | 538 | $this->client->openFolder($this->folder_path); |
539 | 539 | $flags = \imap_fetch_overview($this->client->getConnection(), $this->uid, IMAP::FT_UID); |
540 | 540 | if (is_array($flags) && isset($flags[0])) { |
541 | - foreach($this->available_flags as $flag) { |
|
541 | + foreach ($this->available_flags as $flag) { |
|
542 | 542 | $this->parseFlag($flags, $flag); |
543 | 543 | } |
544 | 544 | } |
@@ -610,7 +610,7 @@ discard block |
||
610 | 610 | } else { |
611 | 611 | $personalParts = \imap_mime_header_decode($address->personal); |
612 | 612 | |
613 | - if(is_array($personalParts)) { |
|
613 | + if (is_array($personalParts)) { |
|
614 | 614 | $address->personal = ''; |
615 | 615 | foreach ($personalParts as $p) { |
616 | 616 | $encoding = (property_exists($p, 'charset')) ? $p->charset : $this->getEncoding($p->text); |
@@ -638,12 +638,12 @@ discard block |
||
638 | 638 | $this->client->openFolder($this->folder_path); |
639 | 639 | $this->structure = \imap_fetchstructure($this->client->getConnection(), $this->uid, IMAP::FT_UID); |
640 | 640 | |
641 | - if(property_exists($this->structure, 'parts')){ |
|
641 | + if (property_exists($this->structure, 'parts')) { |
|
642 | 642 | $parts = $this->structure->parts; |
643 | 643 | |
644 | - foreach ($parts as $part) { |
|
645 | - foreach ($part->parameters as $parameter) { |
|
646 | - if($parameter->attribute == "charset") { |
|
644 | + foreach ($parts as $part) { |
|
645 | + foreach ($part->parameters as $parameter) { |
|
646 | + if ($parameter->attribute == "charset") { |
|
647 | 647 | $encoding = $parameter->value; |
648 | 648 | |
649 | 649 | $encoding = preg_replace('/Content-Transfer-Encoding/', '', $encoding); |
@@ -922,7 +922,7 @@ discard block |
||
922 | 922 | return EncodingAliases::get($parameter->value); |
923 | 923 | } |
924 | 924 | } |
925 | - }elseif (is_string($structure) === true){ |
|
925 | + }elseif (is_string($structure) === true) { |
|
926 | 926 | return mb_detect_encoding($structure); |
927 | 927 | } |
928 | 928 | |
@@ -972,7 +972,7 @@ discard block |
||
972 | 972 | return null; |
973 | 973 | } |
974 | 974 | |
975 | - public function getFolder(){ |
|
975 | + public function getFolder() { |
|
976 | 976 | return $this->client->getFolder($this->folder_path); |
977 | 977 | } |
978 | 978 | |
@@ -988,7 +988,7 @@ discard block |
||
988 | 988 | */ |
989 | 989 | public function moveToFolder($mailbox = 'INBOX', $expunge = false, $create_folder = true) { |
990 | 990 | |
991 | - if($create_folder) $this->client->createFolder($mailbox, true); |
|
991 | + if ($create_folder) $this->client->createFolder($mailbox, true); |
|
992 | 992 | |
993 | 993 | $target_folder = $this->client->getFolder($mailbox); |
994 | 994 | $target_status = $target_folder->getStatus(IMAP::SA_ALL); |
@@ -996,8 +996,8 @@ discard block |
||
996 | 996 | $this->client->openFolder($this->folder_path); |
997 | 997 | $status = \imap_mail_move($this->client->getConnection(), $this->uid, $mailbox, IMAP::CP_UID); |
998 | 998 | |
999 | - if($status === true){ |
|
1000 | - if($expunge) $this->client->expunge(); |
|
999 | + if ($status === true) { |
|
1000 | + if ($expunge) $this->client->expunge(); |
|
1001 | 1001 | $this->client->openFolder($target_folder->path); |
1002 | 1002 | |
1003 | 1003 | $message = $target_folder->getMessage($target_status->uidnext, null, $this->fetch_options, $this->fetch_body, $this->fetch_attachment, $this->fetch_flags); |
@@ -1019,7 +1019,7 @@ discard block |
||
1019 | 1019 | $this->client->openFolder($this->folder_path); |
1020 | 1020 | |
1021 | 1021 | $status = \imap_delete($this->client->getConnection(), $this->uid, IMAP::FT_UID); |
1022 | - if($expunge) $this->client->expunge(); |
|
1022 | + if ($expunge) $this->client->expunge(); |
|
1023 | 1023 | MessageDeletedEvent::dispatch($this); |
1024 | 1024 | |
1025 | 1025 | return $status; |
@@ -1036,7 +1036,7 @@ discard block |
||
1036 | 1036 | $this->client->openFolder($this->folder_path); |
1037 | 1037 | |
1038 | 1038 | $status = \imap_undelete($this->client->getConnection(), $this->uid, IMAP::FT_UID); |
1039 | - if($expunge) $this->client->expunge(); |
|
1039 | + if ($expunge) $this->client->expunge(); |
|
1040 | 1040 | MessageRestoredEvent::dispatch($this); |
1041 | 1041 | |
1042 | 1042 | return $status; |
@@ -1113,7 +1113,7 @@ discard block |
||
1113 | 1113 | * @return string |
1114 | 1114 | * @throws Exceptions\ConnectionFailedException |
1115 | 1115 | */ |
1116 | - public function getToken(){ |
|
1116 | + public function getToken() { |
|
1117 | 1117 | return base64_encode(implode('-', [$this->message_id, $this->subject, strlen($this->getRawBody())])); |
1118 | 1118 | } |
1119 | 1119 | |
@@ -1176,7 +1176,7 @@ discard block |
||
1176 | 1176 | /** |
1177 | 1177 | * @return object|null |
1178 | 1178 | */ |
1179 | - public function getStructure(){ |
|
1179 | + public function getStructure() { |
|
1180 | 1180 | return $this->structure; |
1181 | 1181 | } |
1182 | 1182 | |
@@ -1202,7 +1202,7 @@ discard block |
||
1202 | 1202 | /** |
1203 | 1203 | * @return array |
1204 | 1204 | */ |
1205 | - public function getAttributes(){ |
|
1205 | + public function getAttributes() { |
|
1206 | 1206 | return $this->attributes; |
1207 | 1207 | } |
1208 | 1208 | |
@@ -1210,8 +1210,8 @@ discard block |
||
1210 | 1210 | * @param $mask |
1211 | 1211 | * @return $this |
1212 | 1212 | */ |
1213 | - public function setMask($mask){ |
|
1214 | - if(class_exists($mask)){ |
|
1213 | + public function setMask($mask) { |
|
1214 | + if (class_exists($mask)) { |
|
1215 | 1215 | $this->mask = $mask; |
1216 | 1216 | } |
1217 | 1217 | |
@@ -1221,7 +1221,7 @@ discard block |
||
1221 | 1221 | /** |
1222 | 1222 | * @return string |
1223 | 1223 | */ |
1224 | - public function getMask(){ |
|
1224 | + public function getMask() { |
|
1225 | 1225 | return $this->mask; |
1226 | 1226 | } |
1227 | 1227 | |
@@ -1232,9 +1232,9 @@ discard block |
||
1232 | 1232 | * @return mixed |
1233 | 1233 | * @throws MaskNotFoundException |
1234 | 1234 | */ |
1235 | - public function mask($mask = null){ |
|
1235 | + public function mask($mask = null) { |
|
1236 | 1236 | $mask = $mask !== null ? $mask : $this->mask; |
1237 | - if(class_exists($mask)){ |
|
1237 | + if (class_exists($mask)) { |
|
1238 | 1238 | return new $mask($this); |
1239 | 1239 | } |
1240 | 1240 |
@@ -16,7 +16,7 @@ |
||
16 | 16 | * New custom method which can be called through a mask |
17 | 17 | * @return string |
18 | 18 | */ |
19 | - public function my_token(){ |
|
19 | + public function my_token() { |
|
20 | 20 | return implode('-', [$this->message_id, $this->uid, $this->message_no]); |
21 | 21 | } |
22 | 22 |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | public function __construct(Client $client, $charset = 'UTF-8') { |
70 | 70 | $this->setClient($client); |
71 | 71 | |
72 | - if(config('imap.options.fetch') === IMAP::FT_PEEK) $this->leaveUnread(); |
|
72 | + if (config('imap.options.fetch') === IMAP::FT_PEEK) $this->leaveUnread(); |
|
73 | 73 | |
74 | 74 | $this->date_format = config('imap.date_format', 'd M y'); |
75 | 75 | |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | /** |
82 | 82 | * Instance boot method for additional functionality |
83 | 83 | */ |
84 | - protected function boot(){} |
|
84 | + protected function boot() {} |
|
85 | 85 | |
86 | 86 | /** |
87 | 87 | * Parse a given value |
@@ -89,8 +89,8 @@ discard block |
||
89 | 89 | * |
90 | 90 | * @return string |
91 | 91 | */ |
92 | - protected function parse_value($value){ |
|
93 | - switch(true){ |
|
92 | + protected function parse_value($value) { |
|
93 | + switch (true) { |
|
94 | 94 | case $value instanceof \Carbon\Carbon: |
95 | 95 | $value = $value->format($this->date_format); |
96 | 96 | break; |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | * @throws MessageSearchValidationException |
108 | 108 | */ |
109 | 109 | protected function parse_date($date) { |
110 | - if($date instanceof \Carbon\Carbon) return $date; |
|
110 | + if ($date instanceof \Carbon\Carbon) return $date; |
|
111 | 111 | |
112 | 112 | try { |
113 | 113 | $date = Carbon::parse($date); |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | * @return \Illuminate\Support\Collection |
147 | 147 | * @throws \Webklex\IMAP\Exceptions\ConnectionFailedException |
148 | 148 | */ |
149 | - protected function search(){ |
|
149 | + protected function search() { |
|
150 | 150 | $this->generate_query(); |
151 | 151 | $available_messages = []; |
152 | 152 | |
@@ -159,14 +159,14 @@ discard block |
||
159 | 159 | try { |
160 | 160 | if ($this->getCharset() == null) { |
161 | 161 | $available_messages = \imap_search($this->getClient()->getConnection(), $this->getRawQuery(), IMAP::SE_UID); |
162 | - }else{ |
|
162 | + } else { |
|
163 | 163 | $available_messages = \imap_search($this->getClient()->getConnection(), $this->getRawQuery(), IMAP::SE_UID, $this->getCharset()); |
164 | 164 | } |
165 | 165 | } catch (\Exception $e) { |
166 | 166 | if (strpos($e, ' [BADCHARSET (')) { |
167 | 167 | preg_match('/ \[BADCHARSET \((.*)\)\]/', $e, $matches); |
168 | 168 | if (isset($matches[1])) { |
169 | - if ($matches[1] !== $this->getCharset()){ |
|
169 | + if ($matches[1] !== $this->getCharset()) { |
|
170 | 170 | $this->setCharset($matches[1]); |
171 | 171 | return $this->search(); |
172 | 172 | } |
@@ -210,15 +210,15 @@ discard block |
||
210 | 210 | |
211 | 211 | $options = config('imap.options'); |
212 | 212 | |
213 | - if(strtolower($options['fetch_order']) === 'desc'){ |
|
213 | + if (strtolower($options['fetch_order']) === 'desc') { |
|
214 | 214 | $available_messages = $available_messages->reverse(); |
215 | 215 | } |
216 | 216 | |
217 | - $query =& $this; |
|
217 | + $query = & $this; |
|
218 | 218 | |
219 | 219 | $available_messages->forPage($this->page, $this->limit)->each(function($msgno, $msglist) use(&$messages, $options, $query) { |
220 | 220 | $oMessage = new Message($msgno, $msglist, $query->getClient(), $query->getFetchOptions(), $query->getFetchBody(), $query->getFetchAttachment(), $query->getFetchFlags()); |
221 | - switch ($options['message_key']){ |
|
221 | + switch ($options['message_key']) { |
|
222 | 222 | case 'number': |
223 | 223 | $message_key = $oMessage->getMessageNo(); |
224 | 224 | break; |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | * @return \Illuminate\Pagination\LengthAwarePaginator |
250 | 250 | * @throws GetMessagesFailedException |
251 | 251 | */ |
252 | - public function paginate($per_page = 5, $page = null, $page_name = 'imap_page'){ |
|
252 | + public function paginate($per_page = 5, $page = null, $page_name = 'imap_page') { |
|
253 | 253 | $this->page = $page > $this->page ? $page : $this->page; |
254 | 254 | $this->limit = $per_page; |
255 | 255 | |
@@ -263,23 +263,23 @@ discard block |
||
263 | 263 | * @throws GetMessagesFailedException |
264 | 264 | * @throws \Webklex\IMAP\Exceptions\ConnectionFailedException |
265 | 265 | */ |
266 | - public function idle(callable $callback = null, $timeout = 10){ |
|
266 | + public function idle(callable $callback = null, $timeout = 10) { |
|
267 | 267 | $known_messages = []; |
268 | 268 | $this->get()->each(function($message) use(&$known_messages){ |
269 | 269 | /** @var Message $message */ |
270 | 270 | $known_messages[] = $message->getToken(); |
271 | 271 | }); |
272 | - while ($this->getClient()->isConnected()){ |
|
272 | + while ($this->getClient()->isConnected()) { |
|
273 | 273 | $this->getClient()->expunge(); |
274 | 274 | $this->get()->each(function($message) use(&$known_messages, $callback){ |
275 | 275 | /** @var \Webklex\IMAP\Message $message */ |
276 | 276 | $token = $message->getToken(); |
277 | - if(in_array($token, $known_messages)){ |
|
277 | + if (in_array($token, $known_messages)) { |
|
278 | 278 | return; |
279 | 279 | } |
280 | 280 | $known_messages[] = $token; |
281 | 281 | MessageNewEvent::dispatch($message); |
282 | - if ($callback){ |
|
282 | + if ($callback) { |
|
283 | 283 | $callback($message); |
284 | 284 | } |
285 | 285 | }); |
@@ -298,9 +298,9 @@ discard block |
||
298 | 298 | if (count($statement) == 1) { |
299 | 299 | $query .= $statement[0]; |
300 | 300 | } else { |
301 | - if($statement[1] === null){ |
|
301 | + if ($statement[1] === null) { |
|
302 | 302 | $query .= $statement[0]; |
303 | - }else{ |
|
303 | + } else { |
|
304 | 304 | $query .= $statement[0].' "'.$statement[1].'"'; |
305 | 305 | } |
306 | 306 | } |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | * @return $this |
331 | 331 | */ |
332 | 332 | public function limit($limit, $page = 1) { |
333 | - if($page >= 1) $this->page = $page; |
|
333 | + if ($page >= 1) $this->page = $page; |
|
334 | 334 | $this->limit = $limit; |
335 | 335 | |
336 | 336 | return $this; |
@@ -69,7 +69,9 @@ discard block |
||
69 | 69 | public function __construct(Client $client, $charset = 'UTF-8') { |
70 | 70 | $this->setClient($client); |
71 | 71 | |
72 | - if(config('imap.options.fetch') === IMAP::FT_PEEK) $this->leaveUnread(); |
|
72 | + if(config('imap.options.fetch') === IMAP::FT_PEEK) { |
|
73 | + $this->leaveUnread(); |
|
74 | + } |
|
73 | 75 | |
74 | 76 | $this->date_format = config('imap.date_format', 'd M y'); |
75 | 77 | |
@@ -107,7 +109,9 @@ discard block |
||
107 | 109 | * @throws MessageSearchValidationException |
108 | 110 | */ |
109 | 111 | protected function parse_date($date) { |
110 | - if($date instanceof \Carbon\Carbon) return $date; |
|
112 | + if($date instanceof \Carbon\Carbon) { |
|
113 | + return $date; |
|
114 | + } |
|
111 | 115 | |
112 | 116 | try { |
113 | 117 | $date = Carbon::parse($date); |
@@ -159,7 +163,7 @@ discard block |
||
159 | 163 | try { |
160 | 164 | if ($this->getCharset() == null) { |
161 | 165 | $available_messages = \imap_search($this->getClient()->getConnection(), $this->getRawQuery(), IMAP::SE_UID); |
162 | - }else{ |
|
166 | + } else{ |
|
163 | 167 | $available_messages = \imap_search($this->getClient()->getConnection(), $this->getRawQuery(), IMAP::SE_UID, $this->getCharset()); |
164 | 168 | } |
165 | 169 | } catch (\Exception $e) { |
@@ -300,7 +304,7 @@ discard block |
||
300 | 304 | } else { |
301 | 305 | if($statement[1] === null){ |
302 | 306 | $query .= $statement[0]; |
303 | - }else{ |
|
307 | + } else{ |
|
304 | 308 | $query .= $statement[0].' "'.$statement[1].'"'; |
305 | 309 | } |
306 | 310 | } |
@@ -330,7 +334,9 @@ discard block |
||
330 | 334 | * @return $this |
331 | 335 | */ |
332 | 336 | public function limit($limit, $page = 1) { |
333 | - if($page >= 1) $this->page = $page; |
|
337 | + if($page >= 1) { |
|
338 | + $this->page = $page; |
|
339 | + } |
|
334 | 340 | $this->limit = $limit; |
335 | 341 | |
336 | 342 | return $this; |