@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | throw new AuthFailedException($message); |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | - if(!$this->stream) { |
|
| 88 | + if (!$this->stream) { |
|
| 89 | 89 | $errors = \imap_errors(); |
| 90 | 90 | $message = implode("; ", (is_array($errors) ? $errors : array())); |
| 91 | 91 | throw new AuthFailedException($message); |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | if (!$this->cert_validation) { |
| 117 | 117 | $address .= '/novalidate-cert'; |
| 118 | 118 | } |
| 119 | - if (in_array($this->encryption,['tls', 'notls', 'ssl'])) { |
|
| 119 | + if (in_array($this->encryption, ['tls', 'notls', 'ssl'])) { |
|
| 120 | 120 | $address .= '/'.$this->encryption; |
| 121 | 121 | } elseif ($this->encryption === "starttls") { |
| 122 | 122 | $address .= '/tls'; |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | * |
| 145 | 145 | * @return bool |
| 146 | 146 | */ |
| 147 | - public function connected(){ |
|
| 147 | + public function connected() { |
|
| 148 | 148 | return !$this->stream; |
| 149 | 149 | } |
| 150 | 150 | |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | * |
| 215 | 215 | * @return array |
| 216 | 216 | */ |
| 217 | - public function headers($uids, $rfc = "RFC822"){ |
|
| 217 | + public function headers($uids, $rfc = "RFC822") { |
|
| 218 | 218 | $result = []; |
| 219 | 219 | $uids = is_array($uids) ? $uids : [$uids]; |
| 220 | 220 | foreach ($uids as $uid) { |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | * |
| 230 | 230 | * @return array |
| 231 | 231 | */ |
| 232 | - public function flags($uids){ |
|
| 232 | + public function flags($uids) { |
|
| 233 | 233 | $result = []; |
| 234 | 234 | $uids = is_array($uids) ? $uids : [$uids]; |
| 235 | 235 | foreach ($uids as $uid) { |
@@ -237,8 +237,8 @@ discard block |
||
| 237 | 237 | $flags = []; |
| 238 | 238 | if (is_array($raw_flags) && isset($raw_flags[0])) { |
| 239 | 239 | $raw_flags = (array) $raw_flags[0]; |
| 240 | - foreach($raw_flags as $flag => $value) { |
|
| 241 | - if ($value === 1 && in_array($flag, ["size", "uid", "msgno", "update"]) === false){ |
|
| 240 | + foreach ($raw_flags as $flag => $value) { |
|
| 241 | + if ($value === 1 && in_array($flag, ["size", "uid", "msgno", "update"]) === false) { |
|
| 242 | 242 | $flags[] = "\\".ucfirst($flag); |
| 243 | 243 | } |
| 244 | 244 | } |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | if ($id === null) { |
| 260 | 260 | $overview = $this->overview("1:*"); |
| 261 | 261 | $uids = []; |
| 262 | - foreach($overview as $set){ |
|
| 262 | + foreach ($overview as $set) { |
|
| 263 | 263 | $uids[$set->msgno] = $set->uid; |
| 264 | 264 | } |
| 265 | 265 | return $uids; |
@@ -299,12 +299,12 @@ discard block |
||
| 299 | 299 | $result = []; |
| 300 | 300 | |
| 301 | 301 | $items = \imap_getmailboxes($this->stream, $this->getAddress(), $reference.$folder); |
| 302 | - if(is_array($items)){ |
|
| 302 | + if (is_array($items)) { |
|
| 303 | 303 | foreach ($items as $item) { |
| 304 | 304 | $name = $this->decodeFolderName($item->name); |
| 305 | 305 | $result[$name] = ['delimiter' => $item->delimiter, 'flags' => []]; |
| 306 | 306 | } |
| 307 | - }else{ |
|
| 307 | + }else { |
|
| 308 | 308 | throw new RuntimeException(\imap_last_error()); |
| 309 | 309 | } |
| 310 | 310 | |
@@ -325,9 +325,9 @@ discard block |
||
| 325 | 325 | public function store(array $flags, $from, $to = null, $mode = null, $silent = true) { |
| 326 | 326 | $flag = trim(is_array($flags) ? implode(" ", $flags) : $flags); |
| 327 | 327 | |
| 328 | - if ($mode == "+"){ |
|
| 328 | + if ($mode == "+") { |
|
| 329 | 329 | $status = \imap_setflag_full($this->stream, $from, $flag, IMAP::NIL); |
| 330 | - }else{ |
|
| 330 | + }else { |
|
| 331 | 331 | $status = \imap_clearflag_full($this->stream, $from, $flag, IMAP::NIL); |
| 332 | 332 | } |
| 333 | 333 | |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | */ |
| 350 | 350 | public function appendMessage($folder, $message, $flags = null, $date = null) { |
| 351 | 351 | if ($date != null) { |
| 352 | - if ($date instanceof \Carbon\Carbon){ |
|
| 352 | + if ($date instanceof \Carbon\Carbon) { |
|
| 353 | 353 | $date = $date->format('d-M-Y H:i:s O'); |
| 354 | 354 | } |
| 355 | 355 | return \imap_append($this->stream, $folder, $message, $flags, $date); |
@@ -484,14 +484,14 @@ discard block |
||
| 484 | 484 | /** |
| 485 | 485 | * Enable the debug mode |
| 486 | 486 | */ |
| 487 | - public function enableDebug(){ |
|
| 487 | + public function enableDebug() { |
|
| 488 | 488 | $this->debug = true; |
| 489 | 489 | } |
| 490 | 490 | |
| 491 | 491 | /** |
| 492 | 492 | * Disable the debug mode |
| 493 | 493 | */ |
| 494 | - public function disableDebug(){ |
|
| 494 | + public function disableDebug() { |
|
| 495 | 495 | $this->debug = false; |
| 496 | 496 | } |
| 497 | 497 | |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | $name = $this->decodeFolderName($item->name); |
| 305 | 305 | $result[$name] = ['delimiter' => $item->delimiter, 'flags' => []]; |
| 306 | 306 | } |
| 307 | - }else{ |
|
| 307 | + } else{ |
|
| 308 | 308 | throw new RuntimeException(\imap_last_error()); |
| 309 | 309 | } |
| 310 | 310 | |
@@ -327,7 +327,7 @@ discard block |
||
| 327 | 327 | |
| 328 | 328 | if ($mode == "+"){ |
| 329 | 329 | $status = \imap_setflag_full($this->stream, $from, $flag, IMAP::NIL); |
| 330 | - }else{ |
|
| 330 | + } else{ |
|
| 331 | 331 | $status = \imap_clearflag_full($this->stream, $from, $flag, IMAP::NIL); |
| 332 | 332 | } |
| 333 | 333 | |