@@ -68,7 +68,9 @@ discard block |
||
68 | 68 | public function __construct(Client $client, $charset = 'UTF-8') { |
69 | 69 | $this->setClient($client); |
70 | 70 | |
71 | - if(config('imap.options.fetch') === IMAP::FT_PEEK) $this->leaveUnread(); |
|
71 | + if(config('imap.options.fetch') === IMAP::FT_PEEK) { |
|
72 | + $this->leaveUnread(); |
|
73 | + } |
|
72 | 74 | |
73 | 75 | $this->date_format = config('imap.date_format', 'd M y'); |
74 | 76 | |
@@ -106,7 +108,9 @@ discard block |
||
106 | 108 | * @throws MessageSearchValidationException |
107 | 109 | */ |
108 | 110 | protected function parse_date($date) { |
109 | - if($date instanceof \Carbon\Carbon) return $date; |
|
111 | + if($date instanceof \Carbon\Carbon) { |
|
112 | + return $date; |
|
113 | + } |
|
110 | 114 | |
111 | 115 | try { |
112 | 116 | $date = Carbon::parse($date); |
@@ -154,7 +158,7 @@ discard block |
||
154 | 158 | */ |
155 | 159 | if($this->getCharset() === null){ |
156 | 160 | $available_messages = imap_search($this->getClient()->getConnection(), $this->getRawQuery(), IMAP::SE_UID); |
157 | - }else{ |
|
161 | + } else{ |
|
158 | 162 | $available_messages = imap_search($this->getClient()->getConnection(), $this->getRawQuery(), IMAP::SE_UID, $this->getCharset()); |
159 | 163 | } |
160 | 164 | |
@@ -243,7 +247,7 @@ discard block |
||
243 | 247 | } else { |
244 | 248 | if($statement[1] === null){ |
245 | 249 | $query .= $statement[0]; |
246 | - }else{ |
|
250 | + } else{ |
|
247 | 251 | $query .= $statement[0].' "'.$statement[1].'"'; |
248 | 252 | } |
249 | 253 | } |
@@ -273,7 +277,9 @@ discard block |
||
273 | 277 | * @return $this |
274 | 278 | */ |
275 | 279 | public function limit($limit, $page = 1) { |
276 | - if($page >= 1) $this->page = $page; |
|
280 | + if($page >= 1) { |
|
281 | + $this->page = $page; |
|
282 | + } |
|
277 | 283 | $this->limit = $limit; |
278 | 284 | |
279 | 285 | return $this; |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | return $this->attributes[$name]; |
246 | 246 | } |
247 | 247 | |
248 | - }elseif (strtolower(substr($method, 0, 3)) === 'set') { |
|
248 | + } elseif (strtolower(substr($method, 0, 3)) === 'set') { |
|
249 | 249 | $name = snake_case(substr($method, 3)); |
250 | 250 | |
251 | 251 | if(in_array($name, array_keys($this->attributes))) { |
@@ -365,9 +365,9 @@ discard block |
||
365 | 365 | /** @var Attachment $oAttachment */ |
366 | 366 | if(is_callable($replaceImages)) { |
367 | 367 | $body = $replaceImages($body, $oAttachment); |
368 | - }elseif(is_string($replaceImages)) { |
|
368 | + } elseif(is_string($replaceImages)) { |
|
369 | 369 | call_user_func($replaceImages, [$body, $oAttachment]); |
370 | - }else{ |
|
370 | + } else{ |
|
371 | 371 | if ($oAttachment->id && $oAttachment->getImgSrc() != null) { |
372 | 372 | $body = str_replace('cid:'.$oAttachment->id, $oAttachment->getImgSrc(), $body); |
373 | 373 | } |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | if (property_exists($header, 'subject')) { |
399 | 399 | if($this->config['decoder']['message']['subject'] === 'utf-8') { |
400 | 400 | $this->subject = imap_utf8($header->subject); |
401 | - }else{ |
|
401 | + } else{ |
|
402 | 402 | $this->subject = mb_decode_mimeheader($header->subject); |
403 | 403 | } |
404 | 404 | } |
@@ -909,7 +909,7 @@ discard block |
||
909 | 909 | return EncodingAliases::get($parameter->value); |
910 | 910 | } |
911 | 911 | } |
912 | - }elseif (is_string($structure) === true){ |
|
912 | + } elseif (is_string($structure) === true){ |
|
913 | 913 | return mb_detect_encoding($structure); |
914 | 914 | } |
915 | 915 | |
@@ -975,7 +975,9 @@ discard block |
||
975 | 975 | */ |
976 | 976 | public function moveToFolder($mailbox = 'INBOX', $expunge = false, $create_folder = true) { |
977 | 977 | |
978 | - if($create_folder) $this->client->createFolder($mailbox, true); |
|
978 | + if($create_folder) { |
|
979 | + $this->client->createFolder($mailbox, true); |
|
980 | + } |
|
979 | 981 | |
980 | 982 | $target_folder = $this->client->getFolder($mailbox); |
981 | 983 | $target_status = $target_folder->getStatus(IMAP::SA_ALL); |
@@ -984,7 +986,9 @@ discard block |
||
984 | 986 | $status = imap_mail_move($this->client->getConnection(), $this->uid, $mailbox, IMAP::CP_UID); |
985 | 987 | |
986 | 988 | if($status === true){ |
987 | - if($expunge) $this->client->expunge(); |
|
989 | + if($expunge) { |
|
990 | + $this->client->expunge(); |
|
991 | + } |
|
988 | 992 | $this->client->openFolder($target_folder->path); |
989 | 993 | |
990 | 994 | return $target_folder->getMessage($target_status->uidnext, null, $this->fetch_options, $this->fetch_body, $this->fetch_attachment, $this->fetch_flags); |
@@ -1004,7 +1008,9 @@ discard block |
||
1004 | 1008 | $this->client->openFolder($this->folder_path); |
1005 | 1009 | |
1006 | 1010 | $status = imap_delete($this->client->getConnection(), $this->uid, IMAP::FT_UID); |
1007 | - if($expunge) $this->client->expunge(); |
|
1011 | + if($expunge) { |
|
1012 | + $this->client->expunge(); |
|
1013 | + } |
|
1008 | 1014 | |
1009 | 1015 | return $status; |
1010 | 1016 | } |
@@ -1020,7 +1026,9 @@ discard block |
||
1020 | 1026 | $this->client->openFolder($this->folder_path); |
1021 | 1027 | |
1022 | 1028 | $status = imap_undelete($this->client->getConnection(), $this->uid, IMAP::FT_UID); |
1023 | - if($expunge) $this->client->expunge(); |
|
1029 | + if($expunge) { |
|
1030 | + $this->client->expunge(); |
|
1031 | + } |
|
1024 | 1032 | |
1025 | 1033 | return $status; |
1026 | 1034 | } |