@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | |
| 141 | 141 | $this->parseHeader(); |
| 142 | 142 | |
| 143 | - if($parse_body !== false){ |
|
| 143 | + if ($parse_body !== false) { |
|
| 144 | 144 | $this->parseBody(); |
| 145 | 145 | } |
| 146 | 146 | } |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | * |
| 154 | 154 | * @return bool |
| 155 | 155 | */ |
| 156 | - public function copy($mailbox, $options = 0){ |
|
| 156 | + public function copy($mailbox, $options = 0) { |
|
| 157 | 157 | return imap_mail_copy($this->client->getConnection(), $this->msglist, $mailbox, $options); |
| 158 | 158 | } |
| 159 | 159 | |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | * |
| 166 | 166 | * @return bool |
| 167 | 167 | */ |
| 168 | - public function move($mailbox, $options = 0){ |
|
| 168 | + public function move($mailbox, $options = 0) { |
|
| 169 | 169 | return imap_mail_move($this->client->getConnection(), $this->msglist, $mailbox, $options); |
| 170 | 170 | } |
| 171 | 171 | |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | $body = $this->bodies['html']->content; |
| 216 | 216 | if ($replaceImages) { |
| 217 | 217 | $this->attachments->each(function($oAttachment) use(&$body){ |
| 218 | - if ($oAttachment->id && isset($oAttachment->img_src)){ |
|
| 218 | + if ($oAttachment->id && isset($oAttachment->img_src)) { |
|
| 219 | 219 | $body = str_replace('cid:'.$oAttachment->id, $oAttachment->img_src, $body); |
| 220 | 220 | } |
| 221 | 221 | }); |
@@ -253,10 +253,10 @@ discard block |
||
| 253 | 253 | * |
| 254 | 254 | * Please report any new invalid timestamps to [#45](https://github.com/Webklex/laravel-imap/issues/45) |
| 255 | 255 | */ |
| 256 | - try{ |
|
| 256 | + try { |
|
| 257 | 257 | $this->date = Carbon::parse($date); |
| 258 | - }catch(\Exception $e){ |
|
| 259 | - switch(true){ |
|
| 258 | + } catch (\Exception $e) { |
|
| 259 | + switch (true) { |
|
| 260 | 260 | case preg_match('/([A-Z]{2,3}\,\ [0-9]{1,2}\ [A-Z]{2,3}\ [0-9]{4}\ [0-9]{1,2}\:[0-9]{1,2}\:[0-9]{1,2}\ \+[0-9]{4}\ \([A-Z]{2,3}\+[0-9]{1,2}\:[0-9]{1,2})\)+$/i', $date) > 0: |
| 261 | 261 | $array = explode('(', $date); |
| 262 | 262 | $array = array_reverse($array); |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | } |
| 299 | 299 | if (property_exists($header, 'Msgno')) { |
| 300 | 300 | $this->message_no = ($this->fetch_options == FT_UID) ? trim($header->Msgno) : imap_msgno($this->client->getConnection(), trim($header->Msgno)); |
| 301 | - }else{ |
|
| 301 | + } else { |
|
| 302 | 302 | $this->message_no = imap_msgno($this->client->getConnection(), $this->getUid()); |
| 303 | 303 | } |
| 304 | 304 | } |
@@ -308,10 +308,10 @@ discard block |
||
| 308 | 308 | * |
| 309 | 309 | * @return object |
| 310 | 310 | */ |
| 311 | - public function getHeaderInfo(){ |
|
| 312 | - if($this->header_info == null){ |
|
| 311 | + public function getHeaderInfo() { |
|
| 312 | + if ($this->header_info == null) { |
|
| 313 | 313 | $this->header_info = |
| 314 | - $this->header_info = imap_headerinfo($this->client->getConnection(), $this->getMessageNo());; |
|
| 314 | + $this->header_info = imap_headerinfo($this->client->getConnection(), $this->getMessageNo()); ; |
|
| 315 | 315 | } |
| 316 | 316 | |
| 317 | 317 | return $this->header_info; |
@@ -342,7 +342,7 @@ discard block |
||
| 342 | 342 | |
| 343 | 343 | $address->personal = imap_utf8($address->personal); |
| 344 | 344 | |
| 345 | - $address->mail = ($address->mailbox && $address->host) ? $address->mailbox . '@' . $address->host : false; |
|
| 345 | + $address->mail = ($address->mailbox && $address->host) ? $address->mailbox.'@'.$address->host : false; |
|
| 346 | 346 | $address->full = ($address->personal) ? $address->personal.' <'.$address->mail.'>' : $address->mail; |
| 347 | 347 | |
| 348 | 348 | $addresses[] = $address; |
@@ -416,9 +416,9 @@ discard block |
||
| 416 | 416 | foreach ($structure->parts as $index => $subStruct) { |
| 417 | 417 | $prefix = ""; |
| 418 | 418 | if ($partNumber) { |
| 419 | - $prefix = $partNumber . "."; |
|
| 419 | + $prefix = $partNumber."."; |
|
| 420 | 420 | } |
| 421 | - $this->fetchStructure($subStruct, $prefix . ($index + 1)); |
|
| 421 | + $this->fetchStructure($subStruct, $prefix.($index + 1)); |
|
| 422 | 422 | } |
| 423 | 423 | } else { |
| 424 | 424 | $this->fetchAttachment($structure, $partNumber); |
@@ -431,11 +431,11 @@ discard block |
||
| 431 | 431 | * @param object $structure |
| 432 | 432 | * @param mixed $partNumber |
| 433 | 433 | */ |
| 434 | - protected function fetchAttachment($structure, $partNumber){ |
|
| 434 | + protected function fetchAttachment($structure, $partNumber) { |
|
| 435 | 435 | |
| 436 | 436 | $oAttachment = new Attachment($this, $structure, $partNumber); |
| 437 | 437 | |
| 438 | - if($oAttachment->getName() != null){ |
|
| 438 | + if ($oAttachment->getName() != null) { |
|
| 439 | 439 | if ($oAttachment->getId() != null) { |
| 440 | 440 | $this->attachments->put($oAttachment->getId(), $oAttachment); |
| 441 | 441 | } else { |
@@ -451,10 +451,10 @@ discard block |
||
| 451 | 451 | * |
| 452 | 452 | * @return $this |
| 453 | 453 | */ |
| 454 | - public function setFetchOption($option){ |
|
| 455 | - if(is_long($option) == true){ |
|
| 454 | + public function setFetchOption($option) { |
|
| 455 | + if (is_long($option) == true) { |
|
| 456 | 456 | $this->fetch_options = $option; |
| 457 | - }elseif(is_null($option) == true){ |
|
| 457 | + }elseif (is_null($option) == true) { |
|
| 458 | 458 | $config = config('imap.options.fetch', FT_UID); |
| 459 | 459 | $this->fetch_options = is_long($config) ? $config : 1; |
| 460 | 460 | } |
@@ -499,10 +499,10 @@ discard block |
||
| 499 | 499 | * @return mixed|string |
| 500 | 500 | */ |
| 501 | 501 | private function convertEncoding($str, $from = "ISO-8859-2", $to = "UTF-8") { |
| 502 | - if (function_exists('iconv') && $from!='UTF-7' && $to!='UTF-7') { |
|
| 502 | + if (function_exists('iconv') && $from != 'UTF-7' && $to != 'UTF-7') { |
|
| 503 | 503 | return iconv($from, $to.'//IGNORE', $str); |
| 504 | 504 | } else { |
| 505 | - if (! $from) { |
|
| 505 | + if (!$from) { |
|
| 506 | 506 | return mb_convert_encoding($str, $to); |
| 507 | 507 | } |
| 508 | 508 | return mb_convert_encoding($str, $to, $from); |
@@ -534,10 +534,10 @@ discard block |
||
| 534 | 534 | * |
| 535 | 535 | * @return bool |
| 536 | 536 | */ |
| 537 | - public function moveToFolder($mailbox = 'INBOX'){ |
|
| 537 | + public function moveToFolder($mailbox = 'INBOX') { |
|
| 538 | 538 | $this->client->createFolder($mailbox); |
| 539 | 539 | |
| 540 | - if(imap_mail_move($this->client->getConnection(), $this->msglist, $mailbox) == true){ |
|
| 540 | + if (imap_mail_move($this->client->getConnection(), $this->msglist, $mailbox) == true) { |
|
| 541 | 541 | return true; |
| 542 | 542 | } |
| 543 | 543 | return false; |
@@ -548,7 +548,7 @@ discard block |
||
| 548 | 548 | * |
| 549 | 549 | * @return bool |
| 550 | 550 | */ |
| 551 | - public function delete(){ |
|
| 551 | + public function delete() { |
|
| 552 | 552 | $status = imap_delete($this->client->getConnection(), $this->uid, $this->fetch_options); |
| 553 | 553 | $this->client->expunge(); |
| 554 | 554 | |
@@ -560,7 +560,7 @@ discard block |
||
| 560 | 560 | * |
| 561 | 561 | * @return bool |
| 562 | 562 | */ |
| 563 | - public function restore(){ |
|
| 563 | + public function restore() { |
|
| 564 | 564 | return imap_undelete($this->client->getConnection(), $this->message_no); |
| 565 | 565 | } |
| 566 | 566 | |
@@ -569,7 +569,7 @@ discard block |
||
| 569 | 569 | * |
| 570 | 570 | * @return AttachmentCollection |
| 571 | 571 | */ |
| 572 | - public function getAttachments(){ |
|
| 572 | + public function getAttachments() { |
|
| 573 | 573 | return $this->attachments; |
| 574 | 574 | } |
| 575 | 575 | |
@@ -579,7 +579,7 @@ discard block |
||
| 579 | 579 | * |
| 580 | 580 | * @return bool |
| 581 | 581 | */ |
| 582 | - public function setFlag($flag){ |
|
| 582 | + public function setFlag($flag) { |
|
| 583 | 583 | $flag = "\\".trim(is_array($flag) ? implode(" \\", $flag) : $flag); |
| 584 | 584 | return imap_setflag_full($this->client->getConnection(), $this->getUid(), $flag, SE_UID); |
| 585 | 585 | } |
@@ -590,7 +590,7 @@ discard block |
||
| 590 | 590 | * |
| 591 | 591 | * @return bool |
| 592 | 592 | */ |
| 593 | - public function unsetFlag($flag){ |
|
| 593 | + public function unsetFlag($flag) { |
|
| 594 | 594 | $flag = "\\".trim(is_array($flag) ? implode(" \\", $flag) : $flag); |
| 595 | 595 | return imap_clearflag_full($this->client->getConnection(), $this->getUid(), "\\$flag", SE_UID); |
| 596 | 596 | } |
@@ -598,8 +598,8 @@ discard block |
||
| 598 | 598 | /** |
| 599 | 599 | * @return null|object|string |
| 600 | 600 | */ |
| 601 | - public function getRawBody(){ |
|
| 602 | - if($this->raw_body == null){ |
|
| 601 | + public function getRawBody() { |
|
| 602 | + if ($this->raw_body == null) { |
|
| 603 | 603 | $this->raw_body = imap_fetchbody($this->client->getConnection(), $this->getUid(), ''); |
| 604 | 604 | } |
| 605 | 605 | |
@@ -609,7 +609,7 @@ discard block |
||
| 609 | 609 | /** |
| 610 | 610 | * @return string |
| 611 | 611 | */ |
| 612 | - public function getHeader(){ |
|
| 612 | + public function getHeader() { |
|
| 613 | 613 | return $this->header; |
| 614 | 614 | } |
| 615 | 615 | |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | */ |
| 256 | 256 | try{ |
| 257 | 257 | $this->date = Carbon::parse($date); |
| 258 | - }catch(\Exception $e){ |
|
| 258 | + } catch(\Exception $e){ |
|
| 259 | 259 | switch(true){ |
| 260 | 260 | case preg_match('/([A-Z]{2,3}\,\ [0-9]{1,2}\ [A-Z]{2,3}\ [0-9]{4}\ [0-9]{1,2}\:[0-9]{1,2}\:[0-9]{1,2}\ \+[0-9]{4}\ \([A-Z]{2,3}\+[0-9]{1,2}\:[0-9]{1,2})\)+$/i', $date) > 0: |
| 261 | 261 | $array = explode('(', $date); |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | } |
| 299 | 299 | if (property_exists($header, 'Msgno')) { |
| 300 | 300 | $this->message_no = ($this->fetch_options == FT_UID) ? trim($header->Msgno) : imap_msgno($this->client->getConnection(), trim($header->Msgno)); |
| 301 | - }else{ |
|
| 301 | + } else{ |
|
| 302 | 302 | $this->message_no = imap_msgno($this->client->getConnection(), $this->getUid()); |
| 303 | 303 | } |
| 304 | 304 | } |
@@ -454,7 +454,7 @@ discard block |
||
| 454 | 454 | public function setFetchOption($option){ |
| 455 | 455 | if(is_long($option) == true){ |
| 456 | 456 | $this->fetch_options = $option; |
| 457 | - }elseif(is_null($option) == true){ |
|
| 457 | + } elseif(is_null($option) == true){ |
|
| 458 | 458 | $config = config('imap.options.fetch', FT_UID); |
| 459 | 459 | $this->fetch_options = is_long($config) ? $config : 1; |
| 460 | 460 | } |