@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | |
119 | 119 | $this->setDelimiter($structure->delimiter); |
120 | 120 | $this->path = $structure->name; |
121 | - $this->full_name = $this->decodeName($structure->name); |
|
121 | + $this->full_name = $this->decodeName($structure->name); |
|
122 | 122 | $this->name = $this->getSimpleName($this->delimiter, $this->full_name); |
123 | 123 | |
124 | 124 | $this->parseAttributes($structure->attributes); |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | * @return WhereQuery |
132 | 132 | * @throws Exceptions\ConnectionFailedException |
133 | 133 | */ |
134 | - public function query($charset = 'UTF-8'){ |
|
134 | + public function query($charset = 'UTF-8') { |
|
135 | 135 | $this->getClient()->checkConnection(); |
136 | 136 | $this->getClient()->openFolder($this->path); |
137 | 137 | |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | * @inheritdoc self::query($charset = 'UTF-8') |
143 | 143 | * @throws Exceptions\ConnectionFailedException |
144 | 144 | */ |
145 | - public function search($charset = 'UTF-8'){ |
|
145 | + public function search($charset = 'UTF-8') { |
|
146 | 146 | return $this->query($charset); |
147 | 147 | } |
148 | 148 | |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | * @inheritdoc self::query($charset = 'UTF-8') |
151 | 151 | * @throws Exceptions\ConnectionFailedException |
152 | 152 | */ |
153 | - public function messages($charset = 'UTF-8'){ |
|
153 | + public function messages($charset = 'UTF-8') { |
|
154 | 154 | return $this->query($charset); |
155 | 155 | } |
156 | 156 | |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | * @deprecated 1.2.1:2.0.0 No longer needed. Use Folder::query() instead |
316 | 316 | * @see Folder::query() |
317 | 317 | */ |
318 | - public function searchMessages(array $where, $fetch_options = null, $fetch_body = true, $fetch_attachment = true, $fetch_flags = true, $limit = null, $page = 1, $charset = "UTF-8") { |
|
318 | + public function searchMessages(array $where, $fetch_options = null, $fetch_body = true, $fetch_attachment = true, $fetch_flags = true, $limit = null, $page = 1, $charset = "UTF-8") { |
|
319 | 319 | $this->getClient()->checkConnection(); |
320 | 320 | |
321 | 321 | return $this->query($charset)->where($where)->setFetchOptions($fetch_options)->setFetchBody($fetch_body) |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | */ |
375 | 375 | public function delete($expunge = true) { |
376 | 376 | $status = imap_deletemailbox($this->client->getConnection(), $this->path); |
377 | - if($expunge) $this->client->expunge(); |
|
377 | + if ($expunge) $this->client->expunge(); |
|
378 | 378 | |
379 | 379 | return $status; |
380 | 380 | } |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | */ |
392 | 392 | public function move($target_mailbox, $expunge = true) { |
393 | 393 | $status = imap_renamemailbox($this->client->getConnection(), $this->path, $target_mailbox); |
394 | - if($expunge) $this->client->expunge(); |
|
394 | + if ($expunge) $this->client->expunge(); |
|
395 | 395 | |
396 | 396 | return $status; |
397 | 397 | } |
@@ -440,8 +440,8 @@ discard block |
||
440 | 440 | /** |
441 | 441 | * @param $delimiter |
442 | 442 | */ |
443 | - public function setDelimiter($delimiter){ |
|
444 | - if(in_array($delimiter, [null, '', ' ', false]) === true) { |
|
443 | + public function setDelimiter($delimiter) { |
|
444 | + if (in_array($delimiter, [null, '', ' ', false]) === true) { |
|
445 | 445 | $delimiter = config('imap.options.delimiter', '/'); |
446 | 446 | } |
447 | 447 |
@@ -173,45 +173,45 @@ discard block |
||
173 | 173 | * @throws MaskNotFoundException |
174 | 174 | */ |
175 | 175 | protected function setMaskFromConfig($config) { |
176 | - $default_config = config("imap.masks"); |
|
176 | + $default_config = config("imap.masks"); |
|
177 | 177 | |
178 | - if(isset($config['masks'])){ |
|
179 | - if(isset($config['masks']['message'])) { |
|
180 | - if(class_exists($config['masks']['message'])) { |
|
178 | + if (isset($config['masks'])) { |
|
179 | + if (isset($config['masks']['message'])) { |
|
180 | + if (class_exists($config['masks']['message'])) { |
|
181 | 181 | $this->default_message_mask = $config['masks']['message']; |
182 | - }else{ |
|
182 | + } else { |
|
183 | 183 | throw new MaskNotFoundException("Unknown mask provided: ".$config['masks']['message']); |
184 | 184 | } |
185 | - }else{ |
|
186 | - if(class_exists($default_config['message'])) { |
|
185 | + } else { |
|
186 | + if (class_exists($default_config['message'])) { |
|
187 | 187 | $this->default_message_mask = $default_config['message']; |
188 | - }else{ |
|
188 | + } else { |
|
189 | 189 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['message']); |
190 | 190 | } |
191 | 191 | } |
192 | - if(isset($config['masks']['attachment'])) { |
|
193 | - if(class_exists($config['masks']['attachment'])) { |
|
192 | + if (isset($config['masks']['attachment'])) { |
|
193 | + if (class_exists($config['masks']['attachment'])) { |
|
194 | 194 | $this->default_message_mask = $config['masks']['attachment']; |
195 | - }else{ |
|
195 | + } else { |
|
196 | 196 | throw new MaskNotFoundException("Unknown mask provided: ".$config['masks']['attachment']); |
197 | 197 | } |
198 | - }else{ |
|
199 | - if(class_exists($default_config['attachment'])) { |
|
198 | + } else { |
|
199 | + if (class_exists($default_config['attachment'])) { |
|
200 | 200 | $this->default_message_mask = $default_config['attachment']; |
201 | - }else{ |
|
201 | + } else { |
|
202 | 202 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['attachment']); |
203 | 203 | } |
204 | 204 | } |
205 | - }else{ |
|
206 | - if(class_exists($default_config['message'])) { |
|
205 | + } else { |
|
206 | + if (class_exists($default_config['message'])) { |
|
207 | 207 | $this->default_message_mask = $default_config['message']; |
208 | - }else{ |
|
208 | + } else { |
|
209 | 209 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['message']); |
210 | 210 | } |
211 | 211 | |
212 | - if(class_exists($default_config['attachment'])) { |
|
212 | + if (class_exists($default_config['attachment'])) { |
|
213 | 213 | $this->default_message_mask = $default_config['attachment']; |
214 | - }else{ |
|
214 | + } else { |
|
215 | 215 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['attachment']); |
216 | 216 | } |
217 | 217 | } |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | $pattern = $parent_folder.($hierarchical ? '%' : '*'); |
359 | 359 | |
360 | 360 | $items = imap_getmailboxes($this->connection, $this->getAddress(), $pattern); |
361 | - if(is_array($items)){ |
|
361 | + if (is_array($items)) { |
|
362 | 362 | foreach ($items as $item) { |
363 | 363 | $folder = new Folder($this, $item); |
364 | 364 | |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | } |
374 | 374 | |
375 | 375 | return $folders; |
376 | - }else{ |
|
376 | + } else { |
|
377 | 377 | throw new MailboxFetchingException($this->getLastError()); |
378 | 378 | } |
379 | 379 | } |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | public function openFolder($folder_path, $attempts = 3) { |
390 | 390 | $this->checkConnection(); |
391 | 391 | |
392 | - if(property_exists($folder_path, 'path')) { |
|
392 | + if (property_exists($folder_path, 'path')) { |
|
393 | 393 | $folder_path = $folder_path->path; |
394 | 394 | } |
395 | 395 | |
@@ -410,8 +410,8 @@ discard block |
||
410 | 410 | */ |
411 | 411 | public function createFolder($name, $expunge = true) { |
412 | 412 | $this->checkConnection(); |
413 | - $status = imap_createmailbox($this->getConnection(), $this->getAddress() . imap_utf7_encode($name)); |
|
414 | - if($expunge) $this->expunge(); |
|
413 | + $status = imap_createmailbox($this->getConnection(), $this->getAddress().imap_utf7_encode($name)); |
|
414 | + if ($expunge) $this->expunge(); |
|
415 | 415 | |
416 | 416 | return $status; |
417 | 417 | } |
@@ -427,8 +427,8 @@ discard block |
||
427 | 427 | */ |
428 | 428 | public function renameFolder($old_name, $new_name, $expunge = true) { |
429 | 429 | $this->checkConnection(); |
430 | - $status = imap_renamemailbox($this->getConnection(), $this->getAddress() . imap_utf7_encode($old_name), $this->getAddress() . imap_utf7_encode($new_name)); |
|
431 | - if($expunge) $this->expunge(); |
|
430 | + $status = imap_renamemailbox($this->getConnection(), $this->getAddress().imap_utf7_encode($old_name), $this->getAddress().imap_utf7_encode($new_name)); |
|
431 | + if ($expunge) $this->expunge(); |
|
432 | 432 | |
433 | 433 | return $status; |
434 | 434 | } |
@@ -443,8 +443,8 @@ discard block |
||
443 | 443 | */ |
444 | 444 | public function deleteFolder($name, $expunge = true) { |
445 | 445 | $this->checkConnection(); |
446 | - $status = imap_deletemailbox($this->getConnection(), $this->getAddress() . imap_utf7_encode($name)); |
|
447 | - if($expunge) $this->expunge(); |
|
446 | + $status = imap_deletemailbox($this->getConnection(), $this->getAddress().imap_utf7_encode($name)); |
|
447 | + if ($expunge) $this->expunge(); |
|
448 | 448 | |
449 | 449 | return $status; |
450 | 450 | } |
@@ -538,7 +538,7 @@ discard block |
||
538 | 538 | if (!$this->validate_cert) { |
539 | 539 | $address .= '/novalidate-cert'; |
540 | 540 | } |
541 | - if (in_array($this->encryption,['tls','ssl'])) { |
|
541 | + if (in_array($this->encryption, ['tls', 'ssl'])) { |
|
542 | 542 | $address .= '/'.$this->encryption; |
543 | 543 | } |
544 | 544 | |
@@ -659,7 +659,7 @@ discard block |
||
659 | 659 | * @throws InvalidImapTimeoutTypeException |
660 | 660 | */ |
661 | 661 | public function setTimeout($type, $timeout) { |
662 | - if(0 <= $type && $type <= 4) { |
|
662 | + if (0 <= $type && $type <= 4) { |
|
663 | 663 | return imap_timeout($type, $timeout); |
664 | 664 | } |
665 | 665 | |
@@ -673,8 +673,8 @@ discard block |
||
673 | 673 | * @return mixed |
674 | 674 | * @throws InvalidImapTimeoutTypeException |
675 | 675 | */ |
676 | - public function getTimeout($type){ |
|
677 | - if(0 <= $type && $type <= 4) { |
|
676 | + public function getTimeout($type) { |
|
677 | + if (0 <= $type && $type <= 4) { |
|
678 | 678 | return imap_timeout($type); |
679 | 679 | } |
680 | 680 | |
@@ -684,7 +684,7 @@ discard block |
||
684 | 684 | /** |
685 | 685 | * @return string |
686 | 686 | */ |
687 | - public function getDefaultMessageMask(){ |
|
687 | + public function getDefaultMessageMask() { |
|
688 | 688 | return $this->default_message_mask; |
689 | 689 | } |
690 | 690 | |
@@ -695,7 +695,7 @@ discard block |
||
695 | 695 | * @throws MaskNotFoundException |
696 | 696 | */ |
697 | 697 | public function setDefaultMessageMask($mask) { |
698 | - if(class_exists($mask)) { |
|
698 | + if (class_exists($mask)) { |
|
699 | 699 | $this->default_message_mask = $mask; |
700 | 700 | |
701 | 701 | return $this; |
@@ -707,7 +707,7 @@ discard block |
||
707 | 707 | /** |
708 | 708 | * @return string |
709 | 709 | */ |
710 | - public function getDefaultAttachmentMask(){ |
|
710 | + public function getDefaultAttachmentMask() { |
|
711 | 711 | return $this->default_attachment_mask; |
712 | 712 | } |
713 | 713 | |
@@ -718,7 +718,7 @@ discard block |
||
718 | 718 | * @throws MaskNotFoundException |
719 | 719 | */ |
720 | 720 | public function setDefaultAttachmentMask($mask) { |
721 | - if(class_exists($mask)) { |
|
721 | + if (class_exists($mask)) { |
|
722 | 722 | $this->default_attachment_mask = $mask; |
723 | 723 | |
724 | 724 | return $this; |
@@ -732,7 +732,7 @@ discard block |
||
732 | 732 | * |
733 | 733 | * @return Folder |
734 | 734 | */ |
735 | - public function getFolderPath(){ |
|
735 | + public function getFolderPath() { |
|
736 | 736 | return $this->active_folder; |
737 | 737 | } |
738 | 738 | } |
@@ -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 | |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | $date .= 'C'; |
508 | 508 | break; |
509 | 509 | } |
510 | - try{ |
|
510 | + try { |
|
511 | 511 | $parsed_date = Carbon::parse($date); |
512 | 512 | } catch (\Exception $_e) { |
513 | 513 | throw new InvalidMessageDateException("Invalid message date. ID:".$this->getMessageId(), 1000, $e); |
@@ -530,7 +530,7 @@ discard block |
||
530 | 530 | $this->client->openFolder($this->folder_path); |
531 | 531 | $flags = imap_fetch_overview($this->client->getConnection(), $this->uid, IMAP::FT_UID); |
532 | 532 | if (is_array($flags) && isset($flags[0])) { |
533 | - foreach($this->available_flags as $flag) { |
|
533 | + foreach ($this->available_flags as $flag) { |
|
534 | 534 | $this->parseFlag($flags, $flag); |
535 | 535 | } |
536 | 536 | } |
@@ -627,12 +627,12 @@ discard block |
||
627 | 627 | $this->client->openFolder($this->folder_path); |
628 | 628 | $this->structure = imap_fetchstructure($this->client->getConnection(), $this->uid, IMAP::FT_UID); |
629 | 629 | |
630 | - if(property_exists($this->structure, 'parts')){ |
|
630 | + if (property_exists($this->structure, 'parts')) { |
|
631 | 631 | $parts = $this->structure->parts; |
632 | 632 | |
633 | - foreach ($parts as $part) { |
|
634 | - foreach ($part->parameters as $parameter) { |
|
635 | - if($parameter->attribute == "charset") { |
|
633 | + foreach ($parts as $part) { |
|
634 | + foreach ($part->parameters as $parameter) { |
|
635 | + if ($parameter->attribute == "charset") { |
|
636 | 636 | $encoding = $parameter->value; |
637 | 637 | |
638 | 638 | $encoding = preg_replace('/Content-Transfer-Encoding/', '', $encoding); |
@@ -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 | |
@@ -971,7 +971,7 @@ discard block |
||
971 | 971 | */ |
972 | 972 | public function moveToFolder($mailbox = 'INBOX', $expunge = false, $create_folder = true) { |
973 | 973 | |
974 | - if($create_folder) $this->client->createFolder($mailbox, true); |
|
974 | + if ($create_folder) $this->client->createFolder($mailbox, true); |
|
975 | 975 | |
976 | 976 | $target_folder = $this->client->getFolder($mailbox); |
977 | 977 | $target_status = $target_folder->getStatus(IMAP::SA_ALL); |
@@ -979,8 +979,8 @@ discard block |
||
979 | 979 | $this->client->openFolder($this->folder_path); |
980 | 980 | $status = imap_mail_move($this->client->getConnection(), $this->uid, $mailbox, IMAP::CP_UID); |
981 | 981 | |
982 | - if($status === true){ |
|
983 | - if($expunge) $this->client->expunge(); |
|
982 | + if ($status === true) { |
|
983 | + if ($expunge) $this->client->expunge(); |
|
984 | 984 | $this->client->openFolder($target_folder->path); |
985 | 985 | |
986 | 986 | return $target_folder->getMessage($target_status->uidnext); |
@@ -1000,7 +1000,7 @@ discard block |
||
1000 | 1000 | $this->client->openFolder($this->folder_path); |
1001 | 1001 | |
1002 | 1002 | $status = imap_delete($this->client->getConnection(), $this->uid, IMAP::FT_UID); |
1003 | - if($expunge) $this->client->expunge(); |
|
1003 | + if ($expunge) $this->client->expunge(); |
|
1004 | 1004 | |
1005 | 1005 | return $status; |
1006 | 1006 | } |
@@ -1016,7 +1016,7 @@ discard block |
||
1016 | 1016 | $this->client->openFolder($this->folder_path); |
1017 | 1017 | |
1018 | 1018 | $status = imap_undelete($this->client->getConnection(), $this->uid, IMAP::FT_UID); |
1019 | - if($expunge) $this->client->expunge(); |
|
1019 | + if ($expunge) $this->client->expunge(); |
|
1020 | 1020 | |
1021 | 1021 | return $status; |
1022 | 1022 | } |
@@ -1146,7 +1146,7 @@ discard block |
||
1146 | 1146 | /** |
1147 | 1147 | * @return object|null |
1148 | 1148 | */ |
1149 | - public function getStructure(){ |
|
1149 | + public function getStructure() { |
|
1150 | 1150 | return $this->structure; |
1151 | 1151 | } |
1152 | 1152 | |
@@ -1172,7 +1172,7 @@ discard block |
||
1172 | 1172 | /** |
1173 | 1173 | * @return array |
1174 | 1174 | */ |
1175 | - public function getAttributes(){ |
|
1175 | + public function getAttributes() { |
|
1176 | 1176 | return $this->attributes; |
1177 | 1177 | } |
1178 | 1178 | |
@@ -1180,8 +1180,8 @@ discard block |
||
1180 | 1180 | * @param $mask |
1181 | 1181 | * @return $this |
1182 | 1182 | */ |
1183 | - public function setMask($mask){ |
|
1184 | - if(class_exists($mask)){ |
|
1183 | + public function setMask($mask) { |
|
1184 | + if (class_exists($mask)) { |
|
1185 | 1185 | $this->mask = $mask; |
1186 | 1186 | } |
1187 | 1187 | |
@@ -1191,7 +1191,7 @@ discard block |
||
1191 | 1191 | /** |
1192 | 1192 | * @return string |
1193 | 1193 | */ |
1194 | - public function getMask(){ |
|
1194 | + public function getMask() { |
|
1195 | 1195 | return $this->mask; |
1196 | 1196 | } |
1197 | 1197 | |
@@ -1202,9 +1202,9 @@ discard block |
||
1202 | 1202 | * @return mixed |
1203 | 1203 | * @throws MaskNotFoundException |
1204 | 1204 | */ |
1205 | - public function mask($mask = null){ |
|
1205 | + public function mask($mask = null) { |
|
1206 | 1206 | $mask = $mask !== null ? $mask : $this->mask; |
1207 | - if(class_exists($mask)){ |
|
1207 | + if (class_exists($mask)) { |
|
1208 | 1208 | return new $mask($this); |
1209 | 1209 | } |
1210 | 1210 |
@@ -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 | |
@@ -971,7 +971,9 @@ discard block |
||
971 | 971 | */ |
972 | 972 | public function moveToFolder($mailbox = 'INBOX', $expunge = false, $create_folder = true) { |
973 | 973 | |
974 | - if($create_folder) $this->client->createFolder($mailbox, true); |
|
974 | + if($create_folder) { |
|
975 | + $this->client->createFolder($mailbox, true); |
|
976 | + } |
|
975 | 977 | |
976 | 978 | $target_folder = $this->client->getFolder($mailbox); |
977 | 979 | $target_status = $target_folder->getStatus(IMAP::SA_ALL); |
@@ -980,7 +982,9 @@ discard block |
||
980 | 982 | $status = imap_mail_move($this->client->getConnection(), $this->uid, $mailbox, IMAP::CP_UID); |
981 | 983 | |
982 | 984 | if($status === true){ |
983 | - if($expunge) $this->client->expunge(); |
|
985 | + if($expunge) { |
|
986 | + $this->client->expunge(); |
|
987 | + } |
|
984 | 988 | $this->client->openFolder($target_folder->path); |
985 | 989 | |
986 | 990 | return $target_folder->getMessage($target_status->uidnext); |
@@ -1000,7 +1004,9 @@ discard block |
||
1000 | 1004 | $this->client->openFolder($this->folder_path); |
1001 | 1005 | |
1002 | 1006 | $status = imap_delete($this->client->getConnection(), $this->uid, IMAP::FT_UID); |
1003 | - if($expunge) $this->client->expunge(); |
|
1007 | + if($expunge) { |
|
1008 | + $this->client->expunge(); |
|
1009 | + } |
|
1004 | 1010 | |
1005 | 1011 | return $status; |
1006 | 1012 | } |
@@ -1016,7 +1022,9 @@ discard block |
||
1016 | 1022 | $this->client->openFolder($this->folder_path); |
1017 | 1023 | |
1018 | 1024 | $status = imap_undelete($this->client->getConnection(), $this->uid, IMAP::FT_UID); |
1019 | - if($expunge) $this->client->expunge(); |
|
1025 | + if($expunge) { |
|
1026 | + $this->client->expunge(); |
|
1027 | + } |
|
1020 | 1028 | |
1021 | 1029 | return $status; |
1022 | 1030 | } |