@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | throw new AuthFailedException($message); |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - if(!$this->stream) { |
|
| 90 | + if (!$this->stream) { |
|
| 91 | 91 | $errors = \imap_errors(); |
| 92 | 92 | $message = implode("; ", (is_array($errors) ? $errors : array())); |
| 93 | 93 | throw new AuthFailedException($message); |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | if (!$this->cert_validation) { |
| 119 | 119 | $address .= '/novalidate-cert'; |
| 120 | 120 | } |
| 121 | - if (in_array($this->encryption,['tls', 'notls', 'ssl'])) { |
|
| 121 | + if (in_array($this->encryption, ['tls', 'notls', 'ssl'])) { |
|
| 122 | 122 | $address .= '/'.$this->encryption; |
| 123 | 123 | } elseif ($this->encryption === "starttls") { |
| 124 | 124 | $address .= '/tls'; |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | * |
| 147 | 147 | * @return bool |
| 148 | 148 | */ |
| 149 | - public function connected(){ |
|
| 149 | + public function connected() { |
|
| 150 | 150 | return !$this->stream; |
| 151 | 151 | } |
| 152 | 152 | |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | * |
| 219 | 219 | * @return array |
| 220 | 220 | */ |
| 221 | - public function headers($uids, $rfc = "RFC822", $uid = false){ |
|
| 221 | + public function headers($uids, $rfc = "RFC822", $uid = false) { |
|
| 222 | 222 | $result = []; |
| 223 | 223 | $uids = is_array($uids) ? $uids : [$uids]; |
| 224 | 224 | foreach ($uids as $uid) { |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | * |
| 235 | 235 | * @return array |
| 236 | 236 | */ |
| 237 | - public function flags($uids, $uid = false){ |
|
| 237 | + public function flags($uids, $uid = false) { |
|
| 238 | 238 | $result = []; |
| 239 | 239 | $uids = is_array($uids) ? $uids : [$uids]; |
| 240 | 240 | foreach ($uids as $uid) { |
@@ -242,8 +242,8 @@ discard block |
||
| 242 | 242 | $flags = []; |
| 243 | 243 | if (is_array($raw_flags) && isset($raw_flags[0])) { |
| 244 | 244 | $raw_flags = (array) $raw_flags[0]; |
| 245 | - foreach($raw_flags as $flag => $value) { |
|
| 246 | - if ($value === 1 && in_array($flag, ["size", "uid", "msgno", "update"]) === false){ |
|
| 245 | + foreach ($raw_flags as $flag => $value) { |
|
| 246 | + if ($value === 1 && in_array($flag, ["size", "uid", "msgno", "update"]) === false) { |
|
| 247 | 247 | $flags[] = "\\".ucfirst($flag); |
| 248 | 248 | } |
| 249 | 249 | } |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | if ($id === null) { |
| 265 | 265 | $overview = $this->overview("1:*"); |
| 266 | 266 | $uids = []; |
| 267 | - foreach($overview as $set){ |
|
| 267 | + foreach ($overview as $set) { |
|
| 268 | 268 | $uids[$set->msgno] = $set->uid; |
| 269 | 269 | } |
| 270 | 270 | return $uids; |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | * @return array |
| 291 | 291 | */ |
| 292 | 292 | public function overview($sequence, $uid = false) { |
| 293 | - return \imap_fetch_overview($this->stream, $sequence,$uid ? IMAP::FT_UID : IMAP::NIL); |
|
| 293 | + return \imap_fetch_overview($this->stream, $sequence, $uid ? IMAP::FT_UID : IMAP::NIL); |
|
| 294 | 294 | } |
| 295 | 295 | |
| 296 | 296 | /** |
@@ -305,12 +305,12 @@ discard block |
||
| 305 | 305 | $result = []; |
| 306 | 306 | |
| 307 | 307 | $items = \imap_getmailboxes($this->stream, $this->getAddress(), $reference.$folder); |
| 308 | - if(is_array($items)){ |
|
| 308 | + if (is_array($items)) { |
|
| 309 | 309 | foreach ($items as $item) { |
| 310 | 310 | $name = $this->decodeFolderName($item->name); |
| 311 | 311 | $result[$name] = ['delimiter' => $item->delimiter, 'flags' => []]; |
| 312 | 312 | } |
| 313 | - }else{ |
|
| 313 | + }else { |
|
| 314 | 314 | throw new RuntimeException(\imap_last_error()); |
| 315 | 315 | } |
| 316 | 316 | |
@@ -332,9 +332,9 @@ discard block |
||
| 332 | 332 | public function store(array $flags, $from, $to = null, $mode = null, $silent = true, $uid = false) { |
| 333 | 333 | $flag = trim(is_array($flags) ? implode(" ", $flags) : $flags); |
| 334 | 334 | |
| 335 | - if ($mode == "+"){ |
|
| 335 | + if ($mode == "+") { |
|
| 336 | 336 | $status = \imap_setflag_full($this->stream, $from, $flag, $uid ? IMAP::FT_UID : IMAP::NIL); |
| 337 | - }else{ |
|
| 337 | + }else { |
|
| 338 | 338 | $status = \imap_clearflag_full($this->stream, $from, $flag, $uid ? IMAP::FT_UID : IMAP::NIL); |
| 339 | 339 | } |
| 340 | 340 | |
@@ -356,7 +356,7 @@ discard block |
||
| 356 | 356 | */ |
| 357 | 357 | public function appendMessage($folder, $message, $flags = null, $date = null) { |
| 358 | 358 | if ($date != null) { |
| 359 | - if ($date instanceof \Carbon\Carbon){ |
|
| 359 | + if ($date instanceof \Carbon\Carbon) { |
|
| 360 | 360 | $date = $date->format('d-M-Y H:i:s O'); |
| 361 | 361 | } |
| 362 | 362 | return \imap_append($this->stream, $folder, $message, $flags, $date); |
@@ -493,14 +493,14 @@ discard block |
||
| 493 | 493 | /** |
| 494 | 494 | * Enable the debug mode |
| 495 | 495 | */ |
| 496 | - public function enableDebug(){ |
|
| 496 | + public function enableDebug() { |
|
| 497 | 497 | $this->debug = true; |
| 498 | 498 | } |
| 499 | 499 | |
| 500 | 500 | /** |
| 501 | 501 | * Disable the debug mode |
| 502 | 502 | */ |
| 503 | - public function disableDebug(){ |
|
| 503 | + public function disableDebug() { |
|
| 504 | 504 | $this->debug = false; |
| 505 | 505 | } |
| 506 | 506 | |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | $name = $this->decodeFolderName($item->name); |
| 311 | 311 | $result[$name] = ['delimiter' => $item->delimiter, 'flags' => []]; |
| 312 | 312 | } |
| 313 | - }else{ |
|
| 313 | + } else{ |
|
| 314 | 314 | throw new RuntimeException(\imap_last_error()); |
| 315 | 315 | } |
| 316 | 316 | |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | |
| 335 | 335 | if ($mode == "+"){ |
| 336 | 336 | $status = \imap_setflag_full($this->stream, $from, $flag, $uid ? IMAP::FT_UID : IMAP::NIL); |
| 337 | - }else{ |
|
| 337 | + } else{ |
|
| 338 | 338 | $status = \imap_clearflag_full($this->stream, $from, $flag, $uid ? IMAP::FT_UID : IMAP::NIL); |
| 339 | 339 | } |
| 340 | 340 | |