@@ -33,7 +33,7 @@ |
||
| 33 | 33 | */ |
| 34 | 34 | 'accounts' => [ |
| 35 | 35 | |
| 36 | - 'default' => [ // account identifier |
|
| 36 | + 'default' => [// account identifier |
|
| 37 | 37 | 'host' => env('IMAP_HOST', 'localhost'), |
| 38 | 38 | 'port' => env('IMAP_PORT', 993), |
| 39 | 39 | 'encryption' => env('IMAP_ENCRYPTION', 'ssl'), // Supported: false, 'ssl', 'tls' |
@@ -53,7 +53,7 @@ |
||
| 53 | 53 | // If the connection has not been resolved yet we will resolve it now as all |
| 54 | 54 | // of the connections are resolved when they are actually needed so we do |
| 55 | 55 | // not make any unnecessary connection to the various queue end-points. |
| 56 | - if (! isset($this->accounts[$name])) { |
|
| 56 | + if (!isset($this->accounts[$name])) { |
|
| 57 | 57 | $this->accounts[$name] = $this->resolve($name); |
| 58 | 58 | } |
| 59 | 59 | |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | /** |
| 93 | 93 | * Determine the structure type |
| 94 | 94 | */ |
| 95 | - protected function findType(){ |
|
| 95 | + protected function findType() { |
|
| 96 | 96 | switch ($this->structure->type) { |
| 97 | 97 | case self::TYPE_MESSAGE: |
| 98 | 98 | $this->type = 'message'; |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | /** |
| 125 | 125 | * Fetch the given attachment |
| 126 | 126 | */ |
| 127 | - protected function fetch(){ |
|
| 127 | + protected function fetch() { |
|
| 128 | 128 | |
| 129 | 129 | $content = imap_fetchbody($this->oMessage->getClient()->getConnection(), $this->oMessage->getUid(), $this->part_number, $this->oMessage->getFetchOptions()); |
| 130 | 130 | |
@@ -145,8 +145,8 @@ discard block |
||
| 145 | 145 | } |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | - if(self::TYPE_MESSAGE == $this->structure->type) { |
|
| 149 | - if($this->structure->ifdescription) { |
|
| 148 | + if (self::TYPE_MESSAGE == $this->structure->type) { |
|
| 149 | + if ($this->structure->ifdescription) { |
|
| 150 | 150 | $this->name = $this->structure->description; |
| 151 | 151 | } else { |
| 152 | 152 | $this->name = $this->structure->subtype; |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | * |
| 177 | 177 | * @return boolean |
| 178 | 178 | */ |
| 179 | - public function save($path = null, $filename = null){ |
|
| 179 | + public function save($path = null, $filename = null) { |
|
| 180 | 180 | $path = $path ?: storage_path(); |
| 181 | 181 | $filename = $filename ?: $this->getName(); |
| 182 | 182 | |
@@ -188,49 +188,49 @@ discard block |
||
| 188 | 188 | /** |
| 189 | 189 | * @return null|string |
| 190 | 190 | */ |
| 191 | - public function getContent(){ |
|
| 191 | + public function getContent() { |
|
| 192 | 192 | return $this->content; |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | /** |
| 196 | 196 | * @return null|string |
| 197 | 197 | */ |
| 198 | - public function getType(){ |
|
| 198 | + public function getType() { |
|
| 199 | 199 | return $this->type; |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | /** |
| 203 | 203 | * @return null|string |
| 204 | 204 | */ |
| 205 | - public function getContentType(){ |
|
| 205 | + public function getContentType() { |
|
| 206 | 206 | return $this->content_type; |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | /** |
| 210 | 210 | * @return null|string |
| 211 | 211 | */ |
| 212 | - public function getId(){ |
|
| 212 | + public function getId() { |
|
| 213 | 213 | return $this->id; |
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | /** |
| 217 | 217 | * @return null|string |
| 218 | 218 | */ |
| 219 | - public function getName(){ |
|
| 219 | + public function getName() { |
|
| 220 | 220 | return $this->name; |
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | /** |
| 224 | 224 | * @return null|string |
| 225 | 225 | */ |
| 226 | - public function getDisposition(){ |
|
| 226 | + public function getDisposition() { |
|
| 227 | 227 | return $this->disposition; |
| 228 | 228 | } |
| 229 | 229 | |
| 230 | 230 | /** |
| 231 | 231 | * @return null|string |
| 232 | 232 | */ |
| 233 | - public function getImgSrc(){ |
|
| 233 | + public function getImgSrc() { |
|
| 234 | 234 | return $this->img_src; |
| 235 | 235 | } |
| 236 | 236 | } |
| 237 | 237 | \ No newline at end of file |
@@ -153,8 +153,8 @@ discard block |
||
| 153 | 153 | * |
| 154 | 154 | * @return Message|null |
| 155 | 155 | */ |
| 156 | - public function getMessage($uid, $msglist = null){ |
|
| 157 | - if(imap_msgno($this->getClient()->getConnection(), $uid) > 0){ |
|
| 156 | + public function getMessage($uid, $msglist = null) { |
|
| 157 | + if (imap_msgno($this->getClient()->getConnection(), $uid) > 0) { |
|
| 158 | 158 | return new Message($uid, $msglist, $this->getClient()); |
| 159 | 159 | } |
| 160 | 160 | |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | |
| 261 | 261 | $this->getClient()->checkConnection(); |
| 262 | 262 | |
| 263 | - if($this->validateWhereStatements($where)){ |
|
| 263 | + if ($this->validateWhereStatements($where)) { |
|
| 264 | 264 | throw new MessageSearchValidationException('Invalid imap search criteria provided'); |
| 265 | 265 | } |
| 266 | 266 | |
@@ -269,10 +269,10 @@ discard block |
||
| 269 | 269 | $messages = MessageCollection::make([]); |
| 270 | 270 | |
| 271 | 271 | $query = ''; |
| 272 | - foreach($where as $statement){ |
|
| 273 | - if(count($statement) == 1){ |
|
| 272 | + foreach ($where as $statement) { |
|
| 273 | + if (count($statement) == 1) { |
|
| 274 | 274 | $query .= $statement[0]; |
| 275 | - }else{ |
|
| 275 | + } else { |
|
| 276 | 276 | $query .= $statement[0].' "'.$statement[1].'"'; |
| 277 | 277 | } |
| 278 | 278 | } |
@@ -308,14 +308,14 @@ discard block |
||
| 308 | 308 | * https://tools.ietf.org/html/rfc1064 |
| 309 | 309 | * https://tools.ietf.org/html/rfc822 |
| 310 | 310 | */ |
| 311 | - protected function validateWhereStatements($statements){ |
|
| 312 | - foreach($statements as $statement){ |
|
| 311 | + protected function validateWhereStatements($statements) { |
|
| 312 | + foreach ($statements as $statement) { |
|
| 313 | 313 | $criteria = $statement[0]; |
| 314 | - if(in_array(explode($criteria, ' '), [ |
|
| 314 | + if (in_array(explode($criteria, ' '), [ |
|
| 315 | 315 | 'OR', 'AND', |
| 316 | 316 | 'ALL', 'ANSWERED', 'BCC', 'BEFORE', 'BODY', 'CC', 'DELETED', 'FLAGGED', 'FROM', 'KEYWORD', |
| 317 | 317 | 'NEW', 'OLD', 'ON', 'RECENT', 'SEEN', 'SINCE', 'SUBJECT', 'TEXT', 'TO', |
| 318 | - 'UNANSWERED', 'UNDELETED', 'UNFLAGGED', 'UNKEYWORD', 'UNSEEN']) == false){ |
|
| 318 | + 'UNANSWERED', 'UNDELETED', 'UNFLAGGED', 'UNKEYWORD', 'UNSEEN']) == false) { |
|
| 319 | 319 | return false; |
| 320 | 320 | } |
| 321 | 321 | } |
@@ -356,11 +356,11 @@ discard block |
||
| 356 | 356 | * @param $attributes |
| 357 | 357 | */ |
| 358 | 358 | protected function parseAttributes($attributes) { |
| 359 | - $this->no_inferiors = ($attributes & LATT_NOINFERIORS) ? true : false; |
|
| 360 | - $this->no_select = ($attributes & LATT_NOSELECT) ? true : false; |
|
| 361 | - $this->marked = ($attributes & LATT_MARKED) ? true : false; |
|
| 362 | - $this->referal = ($attributes & LATT_REFERRAL) ? true : false; |
|
| 363 | - $this->has_children = ($attributes & LATT_HASCHILDREN) ? true : false; |
|
| 359 | + $this->no_inferiors = ($attributes & LATT_NOINFERIORS) ? true : false; |
|
| 360 | + $this->no_select = ($attributes & LATT_NOSELECT) ? true : false; |
|
| 361 | + $this->marked = ($attributes & LATT_MARKED) ? true : false; |
|
| 362 | + $this->referal = ($attributes & LATT_REFERRAL) ? true : false; |
|
| 363 | + $this->has_children = ($attributes & LATT_HASCHILDREN) ? true : false; |
|
| 364 | 364 | } |
| 365 | 365 | |
| 366 | 366 | /** |
@@ -368,7 +368,7 @@ discard block |
||
| 368 | 368 | * |
| 369 | 369 | * @return bool |
| 370 | 370 | */ |
| 371 | - public function delete(){ |
|
| 371 | + public function delete() { |
|
| 372 | 372 | $status = imap_deletemailbox($this->client->connection, $this->path); |
| 373 | 373 | $this->client->expunge(); |
| 374 | 374 | |
@@ -382,7 +382,7 @@ discard block |
||
| 382 | 382 | * |
| 383 | 383 | * @return bool |
| 384 | 384 | */ |
| 385 | - public function move($target_mailbox){ |
|
| 385 | + public function move($target_mailbox) { |
|
| 386 | 386 | $status = imap_renamemailbox($this->client->connection, $this->path, $target_mailbox); |
| 387 | 387 | $this->client->expunge(); |
| 388 | 388 | |
@@ -402,7 +402,7 @@ discard block |
||
| 402 | 402 | * |
| 403 | 403 | * @return object |
| 404 | 404 | */ |
| 405 | - public function getStatus($options){ |
|
| 405 | + public function getStatus($options) { |
|
| 406 | 406 | return imap_status($this->client->connection, $this->path, $options); |
| 407 | 407 | } |
| 408 | 408 | |
@@ -415,7 +415,7 @@ discard block |
||
| 415 | 415 | * |
| 416 | 416 | * @return bool |
| 417 | 417 | */ |
| 418 | - public function appendMessage($message, $options = null, $internal_date = null){ |
|
| 418 | + public function appendMessage($message, $options = null, $internal_date = null) { |
|
| 419 | 419 | return imap_append($this->client->connection, $this->path, $message, $options, $internal_date); |
| 420 | 420 | } |
| 421 | 421 | |
@@ -424,7 +424,7 @@ discard block |
||
| 424 | 424 | * |
| 425 | 425 | * @return Client |
| 426 | 426 | */ |
| 427 | - public function getClient(){ |
|
| 427 | + public function getClient() { |
|
| 428 | 428 | return $this->client; |
| 429 | 429 | } |
| 430 | 430 | } |
| 431 | 431 | \ No newline at end of file |
@@ -272,7 +272,7 @@ |
||
| 272 | 272 | foreach($where as $statement){ |
| 273 | 273 | if(count($statement) == 1){ |
| 274 | 274 | $query .= $statement[0]; |
| 275 | - }else{ |
|
| 275 | + } else{ |
|
| 276 | 276 | $query .= $statement[0].' "'.$statement[1].'"'; |
| 277 | 277 | } |
| 278 | 278 | } |
@@ -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 | }); |
@@ -252,10 +252,10 @@ discard block |
||
| 252 | 252 | * |
| 253 | 253 | * Please report any new invalid timestamps to [#45](https://github.com/Webklex/laravel-imap/issues/45) |
| 254 | 254 | */ |
| 255 | - try{ |
|
| 255 | + try { |
|
| 256 | 256 | $this->date = Carbon::parse($date); |
| 257 | - }catch(\Exception $e){ |
|
| 258 | - switch(true){ |
|
| 257 | + } catch (\Exception $e) { |
|
| 258 | + switch (true) { |
|
| 259 | 259 | 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): |
| 260 | 260 | $array = explode('(', $date); |
| 261 | 261 | $array = array_reverse($array); |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | } |
| 295 | 295 | if (property_exists($header, 'Msgno')) { |
| 296 | 296 | $this->message_no = ($this->fetch_options == FT_UID) ? trim($header->Msgno) : imap_msgno($this->client->getConnection(), trim($header->Msgno)); |
| 297 | - }else{ |
|
| 297 | + } else { |
|
| 298 | 298 | $this->message_no = imap_msgno($this->client->getConnection(), $this->getUid()); |
| 299 | 299 | } |
| 300 | 300 | } |
@@ -304,10 +304,10 @@ discard block |
||
| 304 | 304 | * |
| 305 | 305 | * @return object |
| 306 | 306 | */ |
| 307 | - public function getHeaderInfo(){ |
|
| 308 | - if($this->header_info == null){ |
|
| 307 | + public function getHeaderInfo() { |
|
| 308 | + if ($this->header_info == null) { |
|
| 309 | 309 | $this->header_info = |
| 310 | - $this->header_info = imap_headerinfo($this->client->getConnection(), $this->getMessageNo());; |
|
| 310 | + $this->header_info = imap_headerinfo($this->client->getConnection(), $this->getMessageNo()); ; |
|
| 311 | 311 | } |
| 312 | 312 | |
| 313 | 313 | return $this->header_info; |
@@ -338,7 +338,7 @@ discard block |
||
| 338 | 338 | |
| 339 | 339 | $address->personal = imap_utf8($address->personal); |
| 340 | 340 | |
| 341 | - $address->mail = ($address->mailbox && $address->host) ? $address->mailbox . '@' . $address->host : false; |
|
| 341 | + $address->mail = ($address->mailbox && $address->host) ? $address->mailbox.'@'.$address->host : false; |
|
| 342 | 342 | $address->full = ($address->personal) ? $address->personal.' <'.$address->mail.'>' : $address->mail; |
| 343 | 343 | |
| 344 | 344 | $addresses[] = $address; |
@@ -412,9 +412,9 @@ discard block |
||
| 412 | 412 | foreach ($structure->parts as $index => $subStruct) { |
| 413 | 413 | $prefix = ""; |
| 414 | 414 | if ($partNumber) { |
| 415 | - $prefix = $partNumber . "."; |
|
| 415 | + $prefix = $partNumber."."; |
|
| 416 | 416 | } |
| 417 | - $this->fetchStructure($subStruct, $prefix . ($index + 1)); |
|
| 417 | + $this->fetchStructure($subStruct, $prefix.($index + 1)); |
|
| 418 | 418 | } |
| 419 | 419 | } else { |
| 420 | 420 | $this->fetchAttachment($structure, $partNumber); |
@@ -427,11 +427,11 @@ discard block |
||
| 427 | 427 | * @param object $structure |
| 428 | 428 | * @param mixed $partNumber |
| 429 | 429 | */ |
| 430 | - protected function fetchAttachment($structure, $partNumber){ |
|
| 430 | + protected function fetchAttachment($structure, $partNumber) { |
|
| 431 | 431 | |
| 432 | 432 | $oAttachment = new Attachment($this, $structure, $partNumber); |
| 433 | 433 | |
| 434 | - if($oAttachment->getName() != null){ |
|
| 434 | + if ($oAttachment->getName() != null) { |
|
| 435 | 435 | if ($oAttachment->getId() != null) { |
| 436 | 436 | $this->attachments->put($oAttachment->getId(), $oAttachment); |
| 437 | 437 | } else { |
@@ -447,10 +447,10 @@ discard block |
||
| 447 | 447 | * |
| 448 | 448 | * @return $this |
| 449 | 449 | */ |
| 450 | - public function setFetchOption($option){ |
|
| 451 | - if(is_long($option) == true){ |
|
| 450 | + public function setFetchOption($option) { |
|
| 451 | + if (is_long($option) == true) { |
|
| 452 | 452 | $this->fetch_options = $option; |
| 453 | - }elseif(is_null($option) == true){ |
|
| 453 | + }elseif (is_null($option) == true) { |
|
| 454 | 454 | $config = config('imap.options.fetch', FT_UID); |
| 455 | 455 | $this->fetch_options = is_long($config) ? $config : 1; |
| 456 | 456 | } |
@@ -495,10 +495,10 @@ discard block |
||
| 495 | 495 | * @return mixed|string |
| 496 | 496 | */ |
| 497 | 497 | private function convertEncoding($str, $from = "ISO-8859-2", $to = "UTF-8") { |
| 498 | - if (function_exists('iconv') && $from!='UTF-7' && $to!='UTF-7') { |
|
| 498 | + if (function_exists('iconv') && $from != 'UTF-7' && $to != 'UTF-7') { |
|
| 499 | 499 | return iconv($from, $to.'//IGNORE', $str); |
| 500 | 500 | } else { |
| 501 | - if (! $from) { |
|
| 501 | + if (!$from) { |
|
| 502 | 502 | return mb_convert_encoding($str, $to); |
| 503 | 503 | } |
| 504 | 504 | return mb_convert_encoding($str, $to, $from); |
@@ -530,10 +530,10 @@ discard block |
||
| 530 | 530 | * |
| 531 | 531 | * @return bool |
| 532 | 532 | */ |
| 533 | - public function moveToFolder($mailbox = 'INBOX'){ |
|
| 533 | + public function moveToFolder($mailbox = 'INBOX') { |
|
| 534 | 534 | $this->client->createFolder($mailbox); |
| 535 | 535 | |
| 536 | - if(imap_mail_move($this->client->getConnection(), $this->msglist, $mailbox) == true){ |
|
| 536 | + if (imap_mail_move($this->client->getConnection(), $this->msglist, $mailbox) == true) { |
|
| 537 | 537 | return true; |
| 538 | 538 | } |
| 539 | 539 | return false; |
@@ -544,7 +544,7 @@ discard block |
||
| 544 | 544 | * |
| 545 | 545 | * @return bool |
| 546 | 546 | */ |
| 547 | - public function delete(){ |
|
| 547 | + public function delete() { |
|
| 548 | 548 | $status = imap_delete($this->client->getConnection(), $this->uid, $this->fetch_options); |
| 549 | 549 | $this->client->expunge(); |
| 550 | 550 | |
@@ -556,7 +556,7 @@ discard block |
||
| 556 | 556 | * |
| 557 | 557 | * @return bool |
| 558 | 558 | */ |
| 559 | - public function restore(){ |
|
| 559 | + public function restore() { |
|
| 560 | 560 | return imap_undelete($this->client->getConnection(), $this->message_no); |
| 561 | 561 | } |
| 562 | 562 | |
@@ -565,7 +565,7 @@ discard block |
||
| 565 | 565 | * |
| 566 | 566 | * @return AttachmentCollection |
| 567 | 567 | */ |
| 568 | - public function getAttachments(){ |
|
| 568 | + public function getAttachments() { |
|
| 569 | 569 | return $this->attachments; |
| 570 | 570 | } |
| 571 | 571 | |
@@ -575,7 +575,7 @@ discard block |
||
| 575 | 575 | * |
| 576 | 576 | * @return bool |
| 577 | 577 | */ |
| 578 | - public function setFlag($flag){ |
|
| 578 | + public function setFlag($flag) { |
|
| 579 | 579 | $flag = "\\".trim(is_array($flag) ? implode(" \\", $flag) : $flag); |
| 580 | 580 | return imap_setflag_full($this->client->getConnection(), $this->getUid(), $flag, SE_UID); |
| 581 | 581 | } |
@@ -586,7 +586,7 @@ discard block |
||
| 586 | 586 | * |
| 587 | 587 | * @return bool |
| 588 | 588 | */ |
| 589 | - public function unsetFlag($flag){ |
|
| 589 | + public function unsetFlag($flag) { |
|
| 590 | 590 | $flag = "\\".trim(is_array($flag) ? implode(" \\", $flag) : $flag); |
| 591 | 591 | return imap_clearflag_full($this->client->getConnection(), $this->getUid(), "\\$flag", SE_UID); |
| 592 | 592 | } |
@@ -594,8 +594,8 @@ discard block |
||
| 594 | 594 | /** |
| 595 | 595 | * @return null|object|string |
| 596 | 596 | */ |
| 597 | - public function getRawBody(){ |
|
| 598 | - if($this->raw_body == null){ |
|
| 597 | + public function getRawBody() { |
|
| 598 | + if ($this->raw_body == null) { |
|
| 599 | 599 | $this->raw_body = imap_fetchbody($this->client->getConnection(), $this->getUid(), ''); |
| 600 | 600 | } |
| 601 | 601 | |
@@ -605,7 +605,7 @@ discard block |
||
| 605 | 605 | /** |
| 606 | 606 | * @return string |
| 607 | 607 | */ |
| 608 | - public function getHeader(){ |
|
| 608 | + public function getHeader() { |
|
| 609 | 609 | return $this->header; |
| 610 | 610 | } |
| 611 | 611 | |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | */ |
| 255 | 255 | try{ |
| 256 | 256 | $this->date = Carbon::parse($date); |
| 257 | - }catch(\Exception $e){ |
|
| 257 | + } catch(\Exception $e){ |
|
| 258 | 258 | switch(true){ |
| 259 | 259 | 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): |
| 260 | 260 | $array = explode('(', $date); |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | } |
| 295 | 295 | if (property_exists($header, 'Msgno')) { |
| 296 | 296 | $this->message_no = ($this->fetch_options == FT_UID) ? trim($header->Msgno) : imap_msgno($this->client->getConnection(), trim($header->Msgno)); |
| 297 | - }else{ |
|
| 297 | + } else{ |
|
| 298 | 298 | $this->message_no = imap_msgno($this->client->getConnection(), $this->getUid()); |
| 299 | 299 | } |
| 300 | 300 | } |
@@ -450,7 +450,7 @@ discard block |
||
| 450 | 450 | public function setFetchOption($option){ |
| 451 | 451 | if(is_long($option) == true){ |
| 452 | 452 | $this->fetch_options = $option; |
| 453 | - }elseif(is_null($option) == true){ |
|
| 453 | + } elseif(is_null($option) == true){ |
|
| 454 | 454 | $config = config('imap.options.fetch', FT_UID); |
| 455 | 455 | $this->fetch_options = is_long($config) ? $config : 1; |
| 456 | 456 | } |
@@ -40,11 +40,11 @@ |
||
| 40 | 40 | * @return void |
| 41 | 41 | */ |
| 42 | 42 | public function register() { |
| 43 | - $this->app->singleton(ClientManager::class, function ($app) { |
|
| 43 | + $this->app->singleton(ClientManager::class, function($app) { |
|
| 44 | 44 | return new ClientManager($app); |
| 45 | 45 | }); |
| 46 | 46 | |
| 47 | - $this->app->singleton(Client::class, function ($app) { |
|
| 47 | + $this->app->singleton(Client::class, function($app) { |
|
| 48 | 48 | return $app[ClientManager::class]->account(); |
| 49 | 49 | }); |
| 50 | 50 | |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | $defaultAccount = config('imap.default'); |
| 129 | 129 | $defaultConfig = config("imap.accounts.$defaultAccount"); |
| 130 | 130 | |
| 131 | - foreach($defaultConfig as $key => $default){ |
|
| 131 | + foreach ($defaultConfig as $key => $default) { |
|
| 132 | 132 | $this->$key = isset($config[$key]) ? $config[$key] : $default; |
| 133 | 133 | } |
| 134 | 134 | |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | * |
| 141 | 141 | * @return resource |
| 142 | 142 | */ |
| 143 | - public function getConnection(){ |
|
| 143 | + public function getConnection() { |
|
| 144 | 144 | return $this->connection; |
| 145 | 145 | } |
| 146 | 146 | |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | $attempts, |
| 207 | 207 | config('imap.options.open') |
| 208 | 208 | ); |
| 209 | - $this->connected = !! $this->connection; |
|
| 209 | + $this->connected = !!$this->connection; |
|
| 210 | 210 | } catch (\ErrorException $e) { |
| 211 | 211 | $errors = imap_errors(); |
| 212 | 212 | $message = $e->getMessage().'. '.implode("; ", (is_array($errors) ? $errors : array())); |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | public function disconnect() { |
| 226 | 226 | if ($this->isConnected()) { |
| 227 | 227 | $this->errors = array_merge($this->errors, imap_errors() ?: []); |
| 228 | - $this->connected = ! imap_close($this->connection, CL_EXPUNGE); |
|
| 228 | + $this->connected = !imap_close($this->connection, CL_EXPUNGE); |
|
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | return $this; |
@@ -242,11 +242,11 @@ discard block |
||
| 242 | 242 | * |
| 243 | 243 | * @return Folder |
| 244 | 244 | */ |
| 245 | - public function getFolder($folder_name, $attributes = 32, $delimiter = null){ |
|
| 245 | + public function getFolder($folder_name, $attributes = 32, $delimiter = null) { |
|
| 246 | 246 | |
| 247 | 247 | $delimiter = $delimiter == null ? config('imap.options.delimiter', '/') : $delimiter; |
| 248 | 248 | |
| 249 | - $oFolder = new Folder($this, (object)[ |
|
| 249 | + $oFolder = new Folder($this, (object) [ |
|
| 250 | 250 | 'name' => $this->getAddress().$folder_name, |
| 251 | 251 | 'attributes' => $attributes, |
| 252 | 252 | 'delimiter' => $delimiter |
@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | * |
| 314 | 314 | * @return bool |
| 315 | 315 | */ |
| 316 | - public function createFolder($name){ |
|
| 316 | + public function createFolder($name) { |
|
| 317 | 317 | return imap_createmailbox($this->connection, imap_utf7_encode($name)); |
| 318 | 318 | } |
| 319 | 319 | |
@@ -412,7 +412,7 @@ discard block |
||
| 412 | 412 | * |
| 413 | 413 | * @return array |
| 414 | 414 | */ |
| 415 | - public function getQuota(){ |
|
| 415 | + public function getQuota() { |
|
| 416 | 416 | return imap_get_quota($this->connection, 'user.'.$this->username); |
| 417 | 417 | } |
| 418 | 418 | |
@@ -423,7 +423,7 @@ discard block |
||
| 423 | 423 | * |
| 424 | 424 | * @return array |
| 425 | 425 | */ |
| 426 | - public function getQuotaRoot($quota_root = 'INBOX'){ |
|
| 426 | + public function getQuotaRoot($quota_root = 'INBOX') { |
|
| 427 | 427 | return imap_get_quotaroot($this->connection, $quota_root); |
| 428 | 428 | } |
| 429 | 429 | |
@@ -432,7 +432,7 @@ discard block |
||
| 432 | 432 | * |
| 433 | 433 | * @return int |
| 434 | 434 | */ |
| 435 | - public function countMessages(){ |
|
| 435 | + public function countMessages() { |
|
| 436 | 436 | return imap_num_msg($this->connection); |
| 437 | 437 | } |
| 438 | 438 | |
@@ -441,7 +441,7 @@ discard block |
||
| 441 | 441 | * |
| 442 | 442 | * @return int |
| 443 | 443 | */ |
| 444 | - public function countRecentMessages(){ |
|
| 444 | + public function countRecentMessages() { |
|
| 445 | 445 | return imap_num_recent($this->connection); |
| 446 | 446 | } |
| 447 | 447 | |
@@ -450,7 +450,7 @@ discard block |
||
| 450 | 450 | * |
| 451 | 451 | * @return array |
| 452 | 452 | */ |
| 453 | - public function getAlerts(){ |
|
| 453 | + public function getAlerts() { |
|
| 454 | 454 | return imap_alerts(); |
| 455 | 455 | } |
| 456 | 456 | |
@@ -459,7 +459,7 @@ discard block |
||
| 459 | 459 | * |
| 460 | 460 | * @return array |
| 461 | 461 | */ |
| 462 | - public function getErrors(){ |
|
| 462 | + public function getErrors() { |
|
| 463 | 463 | $this->errors = array_merge($this->errors, imap_errors() ?: []); |
| 464 | 464 | |
| 465 | 465 | return $this->errors; |
@@ -470,7 +470,7 @@ discard block |
||
| 470 | 470 | * |
| 471 | 471 | * @return string |
| 472 | 472 | */ |
| 473 | - public function getLastError(){ |
|
| 473 | + public function getLastError() { |
|
| 474 | 474 | return imap_last_error(); |
| 475 | 475 | } |
| 476 | 476 | |
@@ -479,7 +479,7 @@ discard block |
||
| 479 | 479 | * |
| 480 | 480 | * @return bool |
| 481 | 481 | */ |
| 482 | - public function expunge(){ |
|
| 482 | + public function expunge() { |
|
| 483 | 483 | return imap_expunge($this->connection); |
| 484 | 484 | } |
| 485 | 485 | |
@@ -494,7 +494,7 @@ discard block |
||
| 494 | 494 | * Recent [int(0)] number of recent messages in the mailbox |
| 495 | 495 | * } |
| 496 | 496 | */ |
| 497 | - public function checkCurrentMailbox(){ |
|
| 497 | + public function checkCurrentMailbox() { |
|
| 498 | 498 | return imap_check($this->connection); |
| 499 | 499 | } |
| 500 | 500 | } |