@@ -90,16 +90,16 @@ discard block |
||
| 90 | 90 | throw new AuthFailedException($message); |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - if(!$this->stream) { |
|
| 93 | + if (!$this->stream) { |
|
| 94 | 94 | $errors = \imap_errors(); |
| 95 | 95 | $message = implode("; ", (is_array($errors) ? $errors : array())); |
| 96 | 96 | throw new AuthFailedException($message); |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | $errors = \imap_errors(); |
| 100 | - if(is_array($errors)) { |
|
| 100 | + if (is_array($errors)) { |
|
| 101 | 101 | $status = $this->examineFolder(); |
| 102 | - if($status['exists'] !== 0) { |
|
| 102 | + if ($status['exists'] !== 0) { |
|
| 103 | 103 | $message = implode("; ", (is_array($errors) ? $errors : array())); |
| 104 | 104 | throw new RuntimeException($message); |
| 105 | 105 | } |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | if (!$this->cert_validation) { |
| 131 | 131 | $address .= '/novalidate-cert'; |
| 132 | 132 | } |
| 133 | - if (in_array($this->encryption,['tls', 'notls', 'ssl'])) { |
|
| 133 | + if (in_array($this->encryption, ['tls', 'notls', 'ssl'])) { |
|
| 134 | 134 | $address .= '/'.$this->encryption; |
| 135 | 135 | } elseif ($this->encryption === "starttls") { |
| 136 | 136 | $address .= '/tls'; |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | * |
| 161 | 161 | * @return bool |
| 162 | 162 | */ |
| 163 | - public function connected(){ |
|
| 163 | + public function connected() { |
|
| 164 | 164 | return boolval($this->stream); |
| 165 | 165 | } |
| 166 | 166 | |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | * |
| 233 | 233 | * @return array |
| 234 | 234 | */ |
| 235 | - public function headers($uids, $rfc = "RFC822", $uid = false){ |
|
| 235 | + public function headers($uids, $rfc = "RFC822", $uid = false) { |
|
| 236 | 236 | $result = []; |
| 237 | 237 | $uids = is_array($uids) ? $uids : [$uids]; |
| 238 | 238 | foreach ($uids as $id) { |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | * |
| 249 | 249 | * @return array |
| 250 | 250 | */ |
| 251 | - public function flags($uids, $uid = false){ |
|
| 251 | + public function flags($uids, $uid = false) { |
|
| 252 | 252 | $result = []; |
| 253 | 253 | $uids = is_array($uids) ? $uids : [$uids]; |
| 254 | 254 | foreach ($uids as $id) { |
@@ -256,8 +256,8 @@ discard block |
||
| 256 | 256 | $flags = []; |
| 257 | 257 | if (is_array($raw_flags) && isset($raw_flags[0])) { |
| 258 | 258 | $raw_flags = (array) $raw_flags[0]; |
| 259 | - foreach($raw_flags as $flag => $value) { |
|
| 260 | - if ($value === 1 && in_array($flag, ["size", "uid", "msgno", "update"]) === false){ |
|
| 259 | + foreach ($raw_flags as $flag => $value) { |
|
| 260 | + if ($value === 1 && in_array($flag, ["size", "uid", "msgno", "update"]) === false) { |
|
| 261 | 261 | $flags[] = "\\".ucfirst($flag); |
| 262 | 262 | } |
| 263 | 263 | } |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | if ($id === null) { |
| 279 | 279 | $overview = $this->overview("1:*"); |
| 280 | 280 | $uids = []; |
| 281 | - foreach($overview as $set){ |
|
| 281 | + foreach ($overview as $set) { |
|
| 282 | 282 | $uids[$set->msgno] = $set->uid; |
| 283 | 283 | } |
| 284 | 284 | return $uids; |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | * @return array |
| 305 | 305 | */ |
| 306 | 306 | public function overview($sequence, $uid = false) { |
| 307 | - return \imap_fetch_overview($this->stream, $sequence,$uid ? IMAP::FT_UID : IMAP::NIL); |
|
| 307 | + return \imap_fetch_overview($this->stream, $sequence, $uid ? IMAP::FT_UID : IMAP::NIL); |
|
| 308 | 308 | } |
| 309 | 309 | |
| 310 | 310 | /** |
@@ -319,12 +319,12 @@ discard block |
||
| 319 | 319 | $result = []; |
| 320 | 320 | |
| 321 | 321 | $items = \imap_getmailboxes($this->stream, $this->getAddress(), $reference.$folder); |
| 322 | - if(is_array($items)){ |
|
| 322 | + if (is_array($items)) { |
|
| 323 | 323 | foreach ($items as $item) { |
| 324 | 324 | $name = $this->decodeFolderName($item->name); |
| 325 | 325 | $result[$name] = ['delimiter' => $item->delimiter, 'flags' => []]; |
| 326 | 326 | } |
| 327 | - }else{ |
|
| 327 | + }else { |
|
| 328 | 328 | throw new RuntimeException(\imap_last_error()); |
| 329 | 329 | } |
| 330 | 330 | |
@@ -346,9 +346,9 @@ discard block |
||
| 346 | 346 | public function store(array $flags, $from, $to = null, $mode = null, $silent = true, $uid = false) { |
| 347 | 347 | $flag = trim(is_array($flags) ? implode(" ", $flags) : $flags); |
| 348 | 348 | |
| 349 | - if ($mode == "+"){ |
|
| 349 | + if ($mode == "+") { |
|
| 350 | 350 | $status = \imap_setflag_full($this->stream, $from, $flag, $uid ? IMAP::FT_UID : IMAP::NIL); |
| 351 | - }else{ |
|
| 351 | + }else { |
|
| 352 | 352 | $status = \imap_clearflag_full($this->stream, $from, $flag, $uid ? IMAP::FT_UID : IMAP::NIL); |
| 353 | 353 | } |
| 354 | 354 | |
@@ -370,7 +370,7 @@ discard block |
||
| 370 | 370 | */ |
| 371 | 371 | public function appendMessage($folder, $message, $flags = null, $date = null) { |
| 372 | 372 | if ($date != null) { |
| 373 | - if ($date instanceof \Carbon\Carbon){ |
|
| 373 | + if ($date instanceof \Carbon\Carbon) { |
|
| 374 | 374 | $date = $date->format('d-M-Y H:i:s O'); |
| 375 | 375 | } |
| 376 | 376 | return \imap_append($this->stream, $folder, $message, $flags, $date); |
@@ -507,14 +507,14 @@ discard block |
||
| 507 | 507 | /** |
| 508 | 508 | * Enable the debug mode |
| 509 | 509 | */ |
| 510 | - public function enableDebug(){ |
|
| 510 | + public function enableDebug() { |
|
| 511 | 511 | $this->debug = true; |
| 512 | 512 | } |
| 513 | 513 | |
| 514 | 514 | /** |
| 515 | 515 | * Disable the debug mode |
| 516 | 516 | */ |
| 517 | - public function disableDebug(){ |
|
| 517 | + public function disableDebug() { |
|
| 518 | 518 | $this->debug = false; |
| 519 | 519 | } |
| 520 | 520 | |