@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | public function __construct($uid, $msglist, Client $client, $fetch_options = null, $fetch_body = false, $fetch_attachment = false, $fetch_flags = false) { |
197 | 197 | |
198 | 198 | $default_mask = $client->getDefaultMessageMask(); |
199 | - if($default_mask != null) { |
|
199 | + if ($default_mask != null) { |
|
200 | 200 | $this->mask = $default_mask; |
201 | 201 | } |
202 | 202 | |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | $this->msglist = $msglist; |
216 | 216 | $this->client = $client; |
217 | 217 | |
218 | - $this->uid = ($this->fetch_options == IMAP::FT_UID) ? $uid : $uid; |
|
218 | + $this->uid = ($this->fetch_options == IMAP::FT_UID) ? $uid : $uid; |
|
219 | 219 | $this->msgn = ($this->fetch_options == IMAP::FT_UID) ? imap_msgno($this->client->getConnection(), $uid) : $uid; |
220 | 220 | |
221 | 221 | $this->parseHeader(); |
@@ -238,17 +238,17 @@ discard block |
||
238 | 238 | * @throws MethodNotFoundException |
239 | 239 | */ |
240 | 240 | public function __call($method, $arguments) { |
241 | - if(strtolower(substr($method, 0, 3)) === 'get') { |
|
241 | + if (strtolower(substr($method, 0, 3)) === 'get') { |
|
242 | 242 | $name = snake_case(substr($method, 3)); |
243 | 243 | |
244 | - if(in_array($name, array_keys($this->attributes))) { |
|
244 | + if (in_array($name, array_keys($this->attributes))) { |
|
245 | 245 | return $this->attributes[$name]; |
246 | 246 | } |
247 | 247 | |
248 | 248 | }elseif (strtolower(substr($method, 0, 3)) === 'set') { |
249 | 249 | $name = snake_case(substr($method, 3)); |
250 | 250 | |
251 | - if(in_array($name, array_keys($this->attributes))) { |
|
251 | + if (in_array($name, array_keys($this->attributes))) { |
|
252 | 252 | $this->attributes[$name] = array_pop($arguments); |
253 | 253 | |
254 | 254 | return $this->attributes[$name]; |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | * @return mixed|null |
278 | 278 | */ |
279 | 279 | public function __get($name) { |
280 | - if(isset($this->attributes[$name])) { |
|
280 | + if (isset($this->attributes[$name])) { |
|
281 | 281 | return $this->attributes[$name]; |
282 | 282 | } |
283 | 283 | |
@@ -363,11 +363,11 @@ discard block |
||
363 | 363 | if ($replaceImages !== false) { |
364 | 364 | $this->attachments->each(function($oAttachment) use(&$body, $replaceImages) { |
365 | 365 | /** @var Attachment $oAttachment */ |
366 | - if(is_callable($replaceImages)) { |
|
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 | } |
@@ -396,14 +396,14 @@ discard block |
||
396 | 396 | } |
397 | 397 | |
398 | 398 | if (property_exists($header, 'subject')) { |
399 | - if($this->config['decoder']['message']['subject'] === 'utf-8') { |
|
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 | } |
405 | 405 | |
406 | - foreach(['from', 'to', 'cc', 'bcc', 'reply_to', 'sender'] as $part){ |
|
406 | + foreach (['from', 'to', 'cc', 'bcc', 'reply_to', 'sender'] as $part) { |
|
407 | 407 | $this->extractHeaderAddressPart($header, $part); |
408 | 408 | } |
409 | 409 | |
@@ -433,9 +433,9 @@ discard block |
||
433 | 433 | * @return int|null |
434 | 434 | */ |
435 | 435 | private function extractPriority($header) { |
436 | - if(preg_match('/x\-priority\:.*([0-9]{1,2})/i', $header, $priority)){ |
|
436 | + if (preg_match('/x\-priority\:.*([0-9]{1,2})/i', $header, $priority)) { |
|
437 | 437 | $priority = isset($priority[1]) ? (int) $priority[1] : 0; |
438 | - switch($priority){ |
|
438 | + switch ($priority) { |
|
439 | 439 | case IMAP::MESSAGE_PRIORITY_HIGHEST; |
440 | 440 | $priority = IMAP::MESSAGE_PRIORITY_HIGHEST; |
441 | 441 | break; |
@@ -486,7 +486,7 @@ discard block |
||
486 | 486 | if (property_exists($header, 'date')) { |
487 | 487 | $date = $header->date; |
488 | 488 | |
489 | - if(preg_match('/\+0580/', $date)) { |
|
489 | + if (preg_match('/\+0580/', $date)) { |
|
490 | 490 | $date = str_replace('+0580', '+0530', $date); |
491 | 491 | } |
492 | 492 | |
@@ -508,7 +508,7 @@ discard block |
||
508 | 508 | $date = trim(array_pop($array)); |
509 | 509 | break; |
510 | 510 | } |
511 | - try{ |
|
511 | + try { |
|
512 | 512 | $parsed_date = Carbon::parse($date); |
513 | 513 | } catch (\Exception $_e) { |
514 | 514 | throw new InvalidMessageDateException("Invalid message date. ID:".$this->getMessageId(), 1000, $e); |
@@ -531,7 +531,7 @@ discard block |
||
531 | 531 | $this->client->openFolder($this->folder_path); |
532 | 532 | $flags = imap_fetch_overview($this->client->getConnection(), $this->uid, IMAP::FT_UID); |
533 | 533 | if (is_array($flags) && isset($flags[0])) { |
534 | - foreach($this->available_flags as $flag) { |
|
534 | + foreach ($this->available_flags as $flag) { |
|
535 | 535 | $this->parseFlag($flags, $flag); |
536 | 536 | } |
537 | 537 | } |
@@ -628,12 +628,12 @@ discard block |
||
628 | 628 | $this->client->openFolder($this->folder_path); |
629 | 629 | $this->structure = imap_fetchstructure($this->client->getConnection(), $this->uid, IMAP::FT_UID); |
630 | 630 | |
631 | - if(property_exists($this->structure, 'parts')){ |
|
631 | + if (property_exists($this->structure, 'parts')) { |
|
632 | 632 | $parts = $this->structure->parts; |
633 | 633 | |
634 | - foreach ($parts as $part) { |
|
635 | - foreach ($part->parameters as $parameter) { |
|
636 | - if($parameter->attribute == "charset") { |
|
634 | + foreach ($parts as $part) { |
|
635 | + foreach ($part->parameters as $parameter) { |
|
636 | + if ($parameter->attribute == "charset") { |
|
637 | 637 | $encoding = $parameter->value; |
638 | 638 | |
639 | 639 | $encoding = preg_replace('/Content-Transfer-Encoding/', '', $encoding); |
@@ -910,7 +910,7 @@ discard block |
||
910 | 910 | return EncodingAliases::get($parameter->value); |
911 | 911 | } |
912 | 912 | } |
913 | - }elseif (is_string($structure) === true){ |
|
913 | + }elseif (is_string($structure) === true) { |
|
914 | 914 | return mb_detect_encoding($structure); |
915 | 915 | } |
916 | 916 | |
@@ -960,7 +960,7 @@ discard block |
||
960 | 960 | return null; |
961 | 961 | } |
962 | 962 | |
963 | - public function getFolder(){ |
|
963 | + public function getFolder() { |
|
964 | 964 | return $this->client->getFolder($this->folder_path); |
965 | 965 | } |
966 | 966 | |
@@ -976,7 +976,7 @@ discard block |
||
976 | 976 | */ |
977 | 977 | public function moveToFolder($mailbox = 'INBOX', $expunge = false, $create_folder = true) { |
978 | 978 | |
979 | - if($create_folder) $this->client->createFolder($mailbox, true); |
|
979 | + if ($create_folder) $this->client->createFolder($mailbox, true); |
|
980 | 980 | |
981 | 981 | $target_folder = $this->client->getFolder($mailbox); |
982 | 982 | $target_status = $target_folder->getStatus(IMAP::SA_ALL); |
@@ -984,8 +984,8 @@ discard block |
||
984 | 984 | $this->client->openFolder($this->folder_path); |
985 | 985 | $status = imap_mail_move($this->client->getConnection(), $this->uid, $mailbox, IMAP::CP_UID); |
986 | 986 | |
987 | - if($status === true){ |
|
988 | - if($expunge) $this->client->expunge(); |
|
987 | + if ($status === true) { |
|
988 | + if ($expunge) $this->client->expunge(); |
|
989 | 989 | $this->client->openFolder($target_folder->path); |
990 | 990 | |
991 | 991 | return $target_folder->getMessage($target_status->uidnext, null, $this->fetch_options, $this->fetch_body, $this->fetch_attachment, $this->fetch_flags); |
@@ -1005,7 +1005,7 @@ discard block |
||
1005 | 1005 | $this->client->openFolder($this->folder_path); |
1006 | 1006 | |
1007 | 1007 | $status = imap_delete($this->client->getConnection(), $this->uid, IMAP::FT_UID); |
1008 | - if($expunge) $this->client->expunge(); |
|
1008 | + if ($expunge) $this->client->expunge(); |
|
1009 | 1009 | |
1010 | 1010 | return $status; |
1011 | 1011 | } |
@@ -1021,7 +1021,7 @@ discard block |
||
1021 | 1021 | $this->client->openFolder($this->folder_path); |
1022 | 1022 | |
1023 | 1023 | $status = imap_undelete($this->client->getConnection(), $this->uid, IMAP::FT_UID); |
1024 | - if($expunge) $this->client->expunge(); |
|
1024 | + if ($expunge) $this->client->expunge(); |
|
1025 | 1025 | |
1026 | 1026 | return $status; |
1027 | 1027 | } |
@@ -1151,7 +1151,7 @@ discard block |
||
1151 | 1151 | /** |
1152 | 1152 | * @return object|null |
1153 | 1153 | */ |
1154 | - public function getStructure(){ |
|
1154 | + public function getStructure() { |
|
1155 | 1155 | return $this->structure; |
1156 | 1156 | } |
1157 | 1157 | |
@@ -1177,7 +1177,7 @@ discard block |
||
1177 | 1177 | /** |
1178 | 1178 | * @return array |
1179 | 1179 | */ |
1180 | - public function getAttributes(){ |
|
1180 | + public function getAttributes() { |
|
1181 | 1181 | return $this->attributes; |
1182 | 1182 | } |
1183 | 1183 | |
@@ -1185,8 +1185,8 @@ discard block |
||
1185 | 1185 | * @param $mask |
1186 | 1186 | * @return $this |
1187 | 1187 | */ |
1188 | - public function setMask($mask){ |
|
1189 | - if(class_exists($mask)){ |
|
1188 | + public function setMask($mask) { |
|
1189 | + if (class_exists($mask)) { |
|
1190 | 1190 | $this->mask = $mask; |
1191 | 1191 | } |
1192 | 1192 | |
@@ -1196,7 +1196,7 @@ discard block |
||
1196 | 1196 | /** |
1197 | 1197 | * @return string |
1198 | 1198 | */ |
1199 | - public function getMask(){ |
|
1199 | + public function getMask() { |
|
1200 | 1200 | return $this->mask; |
1201 | 1201 | } |
1202 | 1202 | |
@@ -1207,9 +1207,9 @@ discard block |
||
1207 | 1207 | * @return mixed |
1208 | 1208 | * @throws MaskNotFoundException |
1209 | 1209 | */ |
1210 | - public function mask($mask = null){ |
|
1210 | + public function mask($mask = null) { |
|
1211 | 1211 | $mask = $mask !== null ? $mask : $this->mask; |
1212 | - if(class_exists($mask)){ |
|
1212 | + if (class_exists($mask)) { |
|
1213 | 1213 | return new $mask($this); |
1214 | 1214 | } |
1215 | 1215 |