@@ -89,16 +89,16 @@ discard block |
||
| 89 | 89 | throw new AuthFailedException($message); |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - if(!$this->stream) { |
|
| 92 | + if (!$this->stream) { |
|
| 93 | 93 | $errors = \imap_errors(); |
| 94 | 94 | $message = implode("; ", (is_array($errors) ? $errors : array())); |
| 95 | 95 | throw new AuthFailedException($message); |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | $errors = \imap_errors(); |
| 99 | - if(is_array($errors)) { |
|
| 99 | + if (is_array($errors)) { |
|
| 100 | 100 | $status = $this->examineFolder(); |
| 101 | - if($status['exists'] !== 0) { |
|
| 101 | + if ($status['exists'] !== 0) { |
|
| 102 | 102 | $message = implode("; ", (is_array($errors) ? $errors : array())); |
| 103 | 103 | throw new RuntimeException($message); |
| 104 | 104 | } |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | if (!$this->cert_validation) { |
| 130 | 130 | $address .= '/novalidate-cert'; |
| 131 | 131 | } |
| 132 | - if (in_array($this->encryption,['tls', 'notls', 'ssl'])) { |
|
| 132 | + if (in_array($this->encryption, ['tls', 'notls', 'ssl'])) { |
|
| 133 | 133 | $address .= '/'.$this->encryption; |
| 134 | 134 | } elseif ($this->encryption === "starttls") { |
| 135 | 135 | $address .= '/tls'; |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | * |
| 160 | 160 | * @return bool |
| 161 | 161 | */ |
| 162 | - public function connected(){ |
|
| 162 | + public function connected() { |
|
| 163 | 163 | return boolval($this->stream); |
| 164 | 164 | } |
| 165 | 165 | |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | * |
| 232 | 232 | * @return array |
| 233 | 233 | */ |
| 234 | - public function headers($uids, $rfc = "RFC822", $uid = false){ |
|
| 234 | + public function headers($uids, $rfc = "RFC822", $uid = false) { |
|
| 235 | 235 | $result = []; |
| 236 | 236 | $uids = is_array($uids) ? $uids : [$uids]; |
| 237 | 237 | foreach ($uids as $id) { |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | * |
| 248 | 248 | * @return array |
| 249 | 249 | */ |
| 250 | - public function flags($uids, $uid = false){ |
|
| 250 | + public function flags($uids, $uid = false) { |
|
| 251 | 251 | $result = []; |
| 252 | 252 | $uids = is_array($uids) ? $uids : [$uids]; |
| 253 | 253 | foreach ($uids as $id) { |
@@ -255,8 +255,8 @@ discard block |
||
| 255 | 255 | $flags = []; |
| 256 | 256 | if (is_array($raw_flags) && isset($raw_flags[0])) { |
| 257 | 257 | $raw_flags = (array) $raw_flags[0]; |
| 258 | - foreach($raw_flags as $flag => $value) { |
|
| 259 | - if ($value === 1 && in_array($flag, ["size", "uid", "msgno", "update"]) === false){ |
|
| 258 | + foreach ($raw_flags as $flag => $value) { |
|
| 259 | + if ($value === 1 && in_array($flag, ["size", "uid", "msgno", "update"]) === false) { |
|
| 260 | 260 | $flags[] = "\\".ucfirst($flag); |
| 261 | 261 | } |
| 262 | 262 | } |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | if ($id === null) { |
| 278 | 278 | $overview = $this->overview("1:*"); |
| 279 | 279 | $uids = []; |
| 280 | - foreach($overview as $set){ |
|
| 280 | + foreach ($overview as $set) { |
|
| 281 | 281 | $uids[$set->msgno] = $set->uid; |
| 282 | 282 | } |
| 283 | 283 | return $uids; |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | * @return array |
| 304 | 304 | */ |
| 305 | 305 | public function overview($sequence, $uid = false) { |
| 306 | - return \imap_fetch_overview($this->stream, $sequence,$uid ? IMAP::FT_UID : IMAP::NIL); |
|
| 306 | + return \imap_fetch_overview($this->stream, $sequence, $uid ? IMAP::FT_UID : IMAP::NIL); |
|
| 307 | 307 | } |
| 308 | 308 | |
| 309 | 309 | /** |
@@ -318,12 +318,12 @@ discard block |
||
| 318 | 318 | $result = []; |
| 319 | 319 | |
| 320 | 320 | $items = \imap_getmailboxes($this->stream, $this->getAddress(), $reference.$folder); |
| 321 | - if(is_array($items)){ |
|
| 321 | + if (is_array($items)) { |
|
| 322 | 322 | foreach ($items as $item) { |
| 323 | 323 | $name = $this->decodeFolderName($item->name); |
| 324 | 324 | $result[$name] = ['delimiter' => $item->delimiter, 'flags' => []]; |
| 325 | 325 | } |
| 326 | - }else{ |
|
| 326 | + }else { |
|
| 327 | 327 | throw new RuntimeException(\imap_last_error()); |
| 328 | 328 | } |
| 329 | 329 | |
@@ -345,9 +345,9 @@ discard block |
||
| 345 | 345 | public function store(array $flags, $from, $to = null, $mode = null, $silent = true, $uid = false) { |
| 346 | 346 | $flag = trim(is_array($flags) ? implode(" ", $flags) : $flags); |
| 347 | 347 | |
| 348 | - if ($mode == "+"){ |
|
| 348 | + if ($mode == "+") { |
|
| 349 | 349 | $status = \imap_setflag_full($this->stream, $from, $flag, $uid ? IMAP::FT_UID : IMAP::NIL); |
| 350 | - }else{ |
|
| 350 | + }else { |
|
| 351 | 351 | $status = \imap_clearflag_full($this->stream, $from, $flag, $uid ? IMAP::FT_UID : IMAP::NIL); |
| 352 | 352 | } |
| 353 | 353 | |
@@ -369,7 +369,7 @@ discard block |
||
| 369 | 369 | */ |
| 370 | 370 | public function appendMessage($folder, $message, $flags = null, $date = null) { |
| 371 | 371 | if ($date != null) { |
| 372 | - if ($date instanceof \Carbon\Carbon){ |
|
| 372 | + if ($date instanceof \Carbon\Carbon) { |
|
| 373 | 373 | $date = $date->format('d-M-Y H:i:s O'); |
| 374 | 374 | } |
| 375 | 375 | return \imap_append($this->stream, $folder, $message, $flags, $date); |
@@ -401,7 +401,7 @@ discard block |
||
| 401 | 401 | * @return array|bool Tokens if operation successful, false if an error occurred |
| 402 | 402 | */ |
| 403 | 403 | public function copyManyMessages($messages, $folder, $uid = false) { |
| 404 | - foreach($messages as $msg) { |
|
| 404 | + foreach ($messages as $msg) { |
|
| 405 | 405 | if ($this->copyMessage($folder, $msg, null, $uid) == false) { |
| 406 | 406 | return false; |
| 407 | 407 | } |
@@ -433,7 +433,7 @@ discard block |
||
| 433 | 433 | * @return array|bool Tokens if operation successful, false if an error occurred |
| 434 | 434 | */ |
| 435 | 435 | public function moveManyMessages($messages, $folder, $uid = false) { |
| 436 | - foreach($messages as $msg) { |
|
| 436 | + foreach ($messages as $msg) { |
|
| 437 | 437 | if ($this->moveMessage($folder, $msg, null, $uid) == false) { |
| 438 | 438 | return false; |
| 439 | 439 | } |
@@ -542,14 +542,14 @@ discard block |
||
| 542 | 542 | /** |
| 543 | 543 | * Enable the debug mode |
| 544 | 544 | */ |
| 545 | - public function enableDebug(){ |
|
| 545 | + public function enableDebug() { |
|
| 546 | 546 | $this->debug = true; |
| 547 | 547 | } |
| 548 | 548 | |
| 549 | 549 | /** |
| 550 | 550 | * Disable the debug mode |
| 551 | 551 | */ |
| 552 | - public function disableDebug(){ |
|
| 552 | + public function disableDebug() { |
|
| 553 | 553 | $this->debug = false; |
| 554 | 554 | } |
| 555 | 555 | |