@@ -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 | } |
@@ -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 | |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | $defaultAccount = config('imap.default'); |
| 136 | 136 | $defaultConfig = config("imap.accounts.$defaultAccount"); |
| 137 | 137 | |
| 138 | - foreach($this->validConfigKeys as $key){ |
|
| 138 | + foreach ($this->validConfigKeys as $key) { |
|
| 139 | 139 | $this->$key = isset($config[$key]) ? $config[$key] : $defaultConfig[$key]; |
| 140 | 140 | } |
| 141 | 141 | |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | * |
| 148 | 148 | * @return resource |
| 149 | 149 | */ |
| 150 | - public function getConnection(){ |
|
| 150 | + public function getConnection() { |
|
| 151 | 151 | return $this->connection; |
| 152 | 152 | } |
| 153 | 153 | |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | $attempts, |
| 214 | 214 | config('imap.options.open') |
| 215 | 215 | ); |
| 216 | - $this->connected = !! $this->connection; |
|
| 216 | + $this->connected = !!$this->connection; |
|
| 217 | 217 | } catch (\ErrorException $e) { |
| 218 | 218 | $errors = imap_errors(); |
| 219 | 219 | $message = $e->getMessage().'. '.implode("; ", (is_array($errors) ? $errors : array())); |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | public function disconnect() { |
| 233 | 233 | if ($this->isConnected()) { |
| 234 | 234 | $this->errors = array_merge($this->errors, imap_errors() ?: []); |
| 235 | - $this->connected = ! imap_close($this->connection, CL_EXPUNGE); |
|
| 235 | + $this->connected = !imap_close($this->connection, CL_EXPUNGE); |
|
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | return $this; |
@@ -249,11 +249,11 @@ discard block |
||
| 249 | 249 | * |
| 250 | 250 | * @return Folder |
| 251 | 251 | */ |
| 252 | - public function getFolder($folder_name, $attributes = 32, $delimiter = null){ |
|
| 252 | + public function getFolder($folder_name, $attributes = 32, $delimiter = null) { |
|
| 253 | 253 | |
| 254 | 254 | $delimiter = $delimiter == null ? config('imap.options.delimiter', '/') : $delimiter; |
| 255 | 255 | |
| 256 | - $oFolder = new Folder($this, (object)[ |
|
| 256 | + $oFolder = new Folder($this, (object) [ |
|
| 257 | 257 | 'name' => $this->getAddress().$folder_name, |
| 258 | 258 | 'attributes' => $attributes, |
| 259 | 259 | 'delimiter' => $delimiter |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | * |
| 321 | 321 | * @return bool |
| 322 | 322 | */ |
| 323 | - public function createFolder($name){ |
|
| 323 | + public function createFolder($name) { |
|
| 324 | 324 | return imap_createmailbox($this->connection, imap_utf7_encode($name)); |
| 325 | 325 | } |
| 326 | 326 | |
@@ -419,7 +419,7 @@ discard block |
||
| 419 | 419 | * |
| 420 | 420 | * @return array |
| 421 | 421 | */ |
| 422 | - public function getQuota(){ |
|
| 422 | + public function getQuota() { |
|
| 423 | 423 | return imap_get_quota($this->connection, 'user.'.$this->username); |
| 424 | 424 | } |
| 425 | 425 | |
@@ -430,7 +430,7 @@ discard block |
||
| 430 | 430 | * |
| 431 | 431 | * @return array |
| 432 | 432 | */ |
| 433 | - public function getQuotaRoot($quota_root = 'INBOX'){ |
|
| 433 | + public function getQuotaRoot($quota_root = 'INBOX') { |
|
| 434 | 434 | return imap_get_quotaroot($this->connection, $quota_root); |
| 435 | 435 | } |
| 436 | 436 | |
@@ -439,7 +439,7 @@ discard block |
||
| 439 | 439 | * |
| 440 | 440 | * @return int |
| 441 | 441 | */ |
| 442 | - public function countMessages(){ |
|
| 442 | + public function countMessages() { |
|
| 443 | 443 | return imap_num_msg($this->connection); |
| 444 | 444 | } |
| 445 | 445 | |
@@ -448,7 +448,7 @@ discard block |
||
| 448 | 448 | * |
| 449 | 449 | * @return int |
| 450 | 450 | */ |
| 451 | - public function countRecentMessages(){ |
|
| 451 | + public function countRecentMessages() { |
|
| 452 | 452 | return imap_num_recent($this->connection); |
| 453 | 453 | } |
| 454 | 454 | |
@@ -457,7 +457,7 @@ discard block |
||
| 457 | 457 | * |
| 458 | 458 | * @return array |
| 459 | 459 | */ |
| 460 | - public function getAlerts(){ |
|
| 460 | + public function getAlerts() { |
|
| 461 | 461 | return imap_alerts(); |
| 462 | 462 | } |
| 463 | 463 | |
@@ -466,7 +466,7 @@ discard block |
||
| 466 | 466 | * |
| 467 | 467 | * @return array |
| 468 | 468 | */ |
| 469 | - public function getErrors(){ |
|
| 469 | + public function getErrors() { |
|
| 470 | 470 | $this->errors = array_merge($this->errors, imap_errors() ?: []); |
| 471 | 471 | |
| 472 | 472 | return $this->errors; |
@@ -477,7 +477,7 @@ discard block |
||
| 477 | 477 | * |
| 478 | 478 | * @return string |
| 479 | 479 | */ |
| 480 | - public function getLastError(){ |
|
| 480 | + public function getLastError() { |
|
| 481 | 481 | return imap_last_error(); |
| 482 | 482 | } |
| 483 | 483 | |
@@ -486,7 +486,7 @@ discard block |
||
| 486 | 486 | * |
| 487 | 487 | * @return bool |
| 488 | 488 | */ |
| 489 | - public function expunge(){ |
|
| 489 | + public function expunge() { |
|
| 490 | 490 | return imap_expunge($this->connection); |
| 491 | 491 | } |
| 492 | 492 | |
@@ -501,7 +501,7 @@ discard block |
||
| 501 | 501 | * Recent [int(0)] number of recent messages in the mailbox |
| 502 | 502 | * } |
| 503 | 503 | */ |
| 504 | - public function checkCurrentMailbox(){ |
|
| 504 | + public function checkCurrentMailbox() { |
|
| 505 | 505 | return imap_check($this->connection); |
| 506 | 506 | } |
| 507 | 507 | } |
@@ -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 | } |