@@ -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 | |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | * @throws ConnectionFailedException |
| 89 | 89 | * @throws RuntimeException |
| 90 | 90 | */ |
| 91 | - protected function enableTls(){ |
|
| 91 | + protected function enableTls() { |
|
| 92 | 92 | $response = $this->requestAndResponse('STARTTLS'); |
| 93 | 93 | $result = $response && stream_socket_enable_crypto($this->stream, true, $this->getCryptoMethod()); |
| 94 | 94 | if (!$result) { |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | $stack = []; |
| 151 | 151 | |
| 152 | 152 | // replace any trailing <NL> including spaces with a single space |
| 153 | - $line = rtrim($line) . ' '; |
|
| 153 | + $line = rtrim($line).' '; |
|
| 154 | 154 | while (($pos = strpos($line, ' ')) !== false) { |
| 155 | 155 | $token = substr($line, 0, $pos); |
| 156 | 156 | if (!strlen($token)) { |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | $line .= $this->nextLine(); |
| 185 | 185 | } |
| 186 | 186 | $tokens[] = $token; |
| 187 | - $line = trim($line) . ' '; |
|
| 187 | + $line = trim($line).' '; |
|
| 188 | 188 | continue; |
| 189 | 189 | } |
| 190 | 190 | } |
@@ -285,14 +285,14 @@ discard block |
||
| 285 | 285 | public function sendRequest($command, $tokens = [], &$tag = null) { |
| 286 | 286 | if (!$tag) { |
| 287 | 287 | $this->noun++; |
| 288 | - $tag = 'TAG' . $this->noun; |
|
| 288 | + $tag = 'TAG'.$this->noun; |
|
| 289 | 289 | } |
| 290 | 290 | |
| 291 | - $line = $tag . ' ' . $command; |
|
| 291 | + $line = $tag.' '.$command; |
|
| 292 | 292 | |
| 293 | 293 | foreach ($tokens as $token) { |
| 294 | 294 | if (is_array($token)) { |
| 295 | - if (fwrite($this->stream, $line . ' ' . $token[0] . "\r\n") === false) { |
|
| 295 | + if (fwrite($this->stream, $line.' '.$token[0]."\r\n") === false) { |
|
| 296 | 296 | throw new RuntimeException('failed to write - connection closed?'); |
| 297 | 297 | } |
| 298 | 298 | if (!$this->assumedNextLine('+ ')) { |
@@ -300,12 +300,12 @@ discard block |
||
| 300 | 300 | } |
| 301 | 301 | $line = $token[1]; |
| 302 | 302 | } else { |
| 303 | - $line .= ' ' . $token; |
|
| 303 | + $line .= ' '.$token; |
|
| 304 | 304 | } |
| 305 | 305 | } |
| 306 | 306 | if ($this->debug) echo ">> ".$line."\n"; |
| 307 | 307 | |
| 308 | - if (fwrite($this->stream, $line . "\r\n") === false) { |
|
| 308 | + if (fwrite($this->stream, $line."\r\n") === false) { |
|
| 309 | 309 | throw new RuntimeException('failed to write - connection closed?'); |
| 310 | 310 | } |
| 311 | 311 | } |
@@ -335,9 +335,9 @@ discard block |
||
| 335 | 335 | public function escapeString($string) { |
| 336 | 336 | if (func_num_args() < 2) { |
| 337 | 337 | if (strpos($string, "\n") !== false) { |
| 338 | - return ['{' . strlen($string) . '}', $string]; |
|
| 338 | + return ['{'.strlen($string).'}', $string]; |
|
| 339 | 339 | } else { |
| 340 | - return '"' . str_replace(['\\', '"'], ['\\\\', '\\"'], $string) . '"'; |
|
| 340 | + return '"'.str_replace(['\\', '"'], ['\\\\', '\\"'], $string).'"'; |
|
| 341 | 341 | } |
| 342 | 342 | } |
| 343 | 343 | $result = []; |
@@ -362,7 +362,7 @@ discard block |
||
| 362 | 362 | } |
| 363 | 363 | $result[] = $this->escapeList($v); |
| 364 | 364 | } |
| 365 | - return '(' . implode(' ', $result) . ')'; |
|
| 365 | + return '('.implode(' ', $result).')'; |
|
| 366 | 366 | } |
| 367 | 367 | |
| 368 | 368 | /** |
@@ -440,7 +440,7 @@ discard block |
||
| 440 | 440 | * |
| 441 | 441 | * @return bool |
| 442 | 442 | */ |
| 443 | - public function connected(){ |
|
| 443 | + public function connected() { |
|
| 444 | 444 | return (boolean) $this->stream; |
| 445 | 445 | } |
| 446 | 446 | |
@@ -487,10 +487,10 @@ discard block |
||
| 487 | 487 | $result[strtolower($tokens[1])] = $tokens[0]; |
| 488 | 488 | break; |
| 489 | 489 | case '[UIDVALIDITY': |
| 490 | - $result['uidvalidity'] = (int)$tokens[2]; |
|
| 490 | + $result['uidvalidity'] = (int) $tokens[2]; |
|
| 491 | 491 | break; |
| 492 | 492 | case '[UIDNEXT': |
| 493 | - $result['uidnext'] = (int)$tokens[2]; |
|
| 493 | + $result['uidnext'] = (int) $tokens[2]; |
|
| 494 | 494 | break; |
| 495 | 495 | default: |
| 496 | 496 | // ignore |
@@ -544,17 +544,17 @@ discard block |
||
| 544 | 544 | if (is_array($from)) { |
| 545 | 545 | $set = implode(',', $from); |
| 546 | 546 | } elseif ($to === null) { |
| 547 | - $set = (int)$from; |
|
| 547 | + $set = (int) $from; |
|
| 548 | 548 | } elseif ($to === INF) { |
| 549 | - $set = (int)$from . ':*'; |
|
| 549 | + $set = (int) $from.':*'; |
|
| 550 | 550 | } else { |
| 551 | - $set = (int)$from . ':' . (int)$to; |
|
| 551 | + $set = (int) $from.':'.(int) $to; |
|
| 552 | 552 | } |
| 553 | 553 | |
| 554 | - $items = (array)$items; |
|
| 554 | + $items = (array) $items; |
|
| 555 | 555 | $itemList = $this->escapeList($items); |
| 556 | 556 | |
| 557 | - $this->sendRequest(($uid ? 'UID ' : '') . 'FETCH', [$set, $itemList], $tag); |
|
| 557 | + $this->sendRequest(($uid ? 'UID ' : '').'FETCH', [$set, $itemList], $tag); |
|
| 558 | 558 | |
| 559 | 559 | $result = []; |
| 560 | 560 | $tokens = null; // define $tokens variable before first use |
@@ -616,7 +616,7 @@ discard block |
||
| 616 | 616 | } |
| 617 | 617 | if ($uid) { |
| 618 | 618 | $result[$tokens[2][$uidKey]] = $data; |
| 619 | - }else{ |
|
| 619 | + } else { |
|
| 620 | 620 | $result[$tokens[0]] = $data; |
| 621 | 621 | } |
| 622 | 622 | } |
@@ -650,7 +650,7 @@ discard block |
||
| 650 | 650 | * @return array |
| 651 | 651 | * @throws RuntimeException |
| 652 | 652 | */ |
| 653 | - public function headers($uids, $rfc = "RFC822", $uid = false){ |
|
| 653 | + public function headers($uids, $rfc = "RFC822", $uid = false) { |
|
| 654 | 654 | return $this->fetch(["$rfc.HEADER"], $uids, null, $uid); |
| 655 | 655 | } |
| 656 | 656 | |
@@ -662,7 +662,7 @@ discard block |
||
| 662 | 662 | * @return array |
| 663 | 663 | * @throws RuntimeException |
| 664 | 664 | */ |
| 665 | - public function flags($uids, $uid = false){ |
|
| 665 | + public function flags($uids, $uid = false) { |
|
| 666 | 666 | return $this->fetch(["FLAGS"], $uids, null, $uid); |
| 667 | 667 | } |
| 668 | 668 | |
@@ -749,23 +749,23 @@ discard block |
||
| 749 | 749 | public function store(array $flags, $from, $to = null, $mode = null, $silent = true, $uid = false) { |
| 750 | 750 | $item = 'FLAGS'; |
| 751 | 751 | if ($mode == '+' || $mode == '-') { |
| 752 | - $item = $mode . $item; |
|
| 752 | + $item = $mode.$item; |
|
| 753 | 753 | } |
| 754 | 754 | if ($silent) { |
| 755 | 755 | $item .= '.SILENT'; |
| 756 | 756 | } |
| 757 | 757 | |
| 758 | 758 | $flags = $this->escapeList($flags); |
| 759 | - $set = (int)$from; |
|
| 759 | + $set = (int) $from; |
|
| 760 | 760 | if ($to !== null) { |
| 761 | - $set .= ':' . ($to == INF ? '*' : (int)$to); |
|
| 761 | + $set .= ':'.($to == INF ? '*' : (int) $to); |
|
| 762 | 762 | } |
| 763 | 763 | |
| 764 | 764 | $command = ($uid ? "UID " : "")."STORE"; |
| 765 | 765 | $result = $this->requestAndResponse($command, [$set, $item, $flags], $silent); |
| 766 | 766 | |
| 767 | 767 | if ($silent) { |
| 768 | - return (bool)$result; |
|
| 768 | + return (bool) $result; |
|
| 769 | 769 | } |
| 770 | 770 | |
| 771 | 771 | $tokens = $result; |
@@ -816,9 +816,9 @@ discard block |
||
| 816 | 816 | * @throws RuntimeException |
| 817 | 817 | */ |
| 818 | 818 | public function copyMessage($folder, $from, $to = null, $uid = false) { |
| 819 | - $set = (int)$from; |
|
| 819 | + $set = (int) $from; |
|
| 820 | 820 | if ($to !== null) { |
| 821 | - $set .= ':' . ($to == INF ? '*' : (int)$to); |
|
| 821 | + $set .= ':'.($to == INF ? '*' : (int) $to); |
|
| 822 | 822 | } |
| 823 | 823 | $command = ($uid ? "UID " : "")."COPY"; |
| 824 | 824 | |
@@ -856,9 +856,9 @@ discard block |
||
| 856 | 856 | * @throws RuntimeException |
| 857 | 857 | */ |
| 858 | 858 | public function moveMessage($folder, $from, $to = null, $uid = false) { |
| 859 | - $set = (int)$from; |
|
| 859 | + $set = (int) $from; |
|
| 860 | 860 | if ($to !== null) { |
| 861 | - $set .= ':' . ($to == INF ? '*' : (int)$to); |
|
| 861 | + $set .= ':'.($to == INF ? '*' : (int) $to); |
|
| 862 | 862 | } |
| 863 | 863 | $command = ($uid ? "UID " : "")."MOVE"; |
| 864 | 864 | |
@@ -1047,7 +1047,7 @@ discard block |
||
| 1047 | 1047 | $ids = []; |
| 1048 | 1048 | foreach ($uids as $msgn => $v) { |
| 1049 | 1049 | $id = $uid ? $v : $msgn; |
| 1050 | - if ( ($to >= $id && $from <= $id) || ($to === "*" && $from <= $id) ){ |
|
| 1050 | + if (($to >= $id && $from <= $id) || ($to === "*" && $from <= $id)) { |
|
| 1051 | 1051 | $ids[] = $id; |
| 1052 | 1052 | } |
| 1053 | 1053 | } |
@@ -1061,14 +1061,14 @@ discard block |
||
| 1061 | 1061 | /** |
| 1062 | 1062 | * Enable the debug mode |
| 1063 | 1063 | */ |
| 1064 | - public function enableDebug(){ |
|
| 1064 | + public function enableDebug() { |
|
| 1065 | 1065 | $this->debug = true; |
| 1066 | 1066 | } |
| 1067 | 1067 | |
| 1068 | 1068 | /** |
| 1069 | 1069 | * Disable the debug mode |
| 1070 | 1070 | */ |
| 1071 | - public function disableDebug(){ |
|
| 1071 | + public function disableDebug() { |
|
| 1072 | 1072 | $this->debug = false; |
| 1073 | 1073 | } |
| 1074 | 1074 | } |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | * |
| 58 | 58 | * @return string |
| 59 | 59 | */ |
| 60 | - public function toString(){ |
|
| 60 | + public function toString() { |
|
| 61 | 61 | return $this->__toString(); |
| 62 | 62 | } |
| 63 | 63 | |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | * |
| 67 | 67 | * @return array |
| 68 | 68 | */ |
| 69 | - public function __serialize(){ |
|
| 69 | + public function __serialize() { |
|
| 70 | 70 | return $this->values; |
| 71 | 71 | } |
| 72 | 72 | |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | * |
| 76 | 76 | * @return array |
| 77 | 77 | */ |
| 78 | - public function toArray(){ |
|
| 78 | + public function toArray() { |
|
| 79 | 79 | return $this->__serialize(); |
| 80 | 80 | } |
| 81 | 81 | |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | * |
| 85 | 85 | * @return Carbon|null |
| 86 | 86 | */ |
| 87 | - public function toDate(){ |
|
| 87 | + public function toDate() { |
|
| 88 | 88 | $date = $this->first(); |
| 89 | 89 | if ($date instanceof Carbon) return $date; |
| 90 | 90 | |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | if ($this->contains($value) === false) { |
| 196 | 196 | $this->values[] = $value; |
| 197 | 197 | } |
| 198 | - }else{ |
|
| 198 | + } else { |
|
| 199 | 199 | $this->values[] = $value; |
| 200 | 200 | } |
| 201 | 201 | } |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | * |
| 207 | 207 | * @return Attribute |
| 208 | 208 | */ |
| 209 | - public function setName($name){ |
|
| 209 | + public function setName($name) { |
|
| 210 | 210 | $this->name = $name; |
| 211 | 211 | |
| 212 | 212 | return $this; |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | * |
| 218 | 218 | * @return string |
| 219 | 219 | */ |
| 220 | - public function getName(){ |
|
| 220 | + public function getName() { |
|
| 221 | 221 | return $this->name; |
| 222 | 222 | } |
| 223 | 223 | |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | * |
| 227 | 227 | * @return array |
| 228 | 228 | */ |
| 229 | - public function get(){ |
|
| 229 | + public function get() { |
|
| 230 | 230 | return $this->values; |
| 231 | 231 | } |
| 232 | 232 | |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | * |
| 236 | 236 | * @return array |
| 237 | 237 | */ |
| 238 | - public function all(){ |
|
| 238 | + public function all() { |
|
| 239 | 239 | return $this->get(); |
| 240 | 240 | } |
| 241 | 241 | |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | * |
| 245 | 245 | * @return mixed|null |
| 246 | 246 | */ |
| 247 | - public function first(){ |
|
| 247 | + public function first() { |
|
| 248 | 248 | if ($this->offsetExists(0)) { |
| 249 | 249 | return $this->values[0]; |
| 250 | 250 | } |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | * |
| 257 | 257 | * @return mixed|null |
| 258 | 258 | */ |
| 259 | - public function last(){ |
|
| 259 | + public function last() { |
|
| 260 | 260 | if (($cnt = $this->count()) > 0) { |
| 261 | 261 | return $this->values[$cnt - 1]; |
| 262 | 262 | } |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | * |
| 269 | 269 | * @return int |
| 270 | 270 | */ |
| 271 | - public function count(){ |
|
| 271 | + public function count() { |
|
| 272 | 272 | return count($this->values); |
| 273 | 273 | } |
| 274 | 274 | } |
| 275 | 275 | \ No newline at end of file |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | $this->part_number = $part->part_number; |
| 104 | 104 | |
| 105 | 105 | $default_mask = $this->oMessage->getClient()->getDefaultAttachmentMask(); |
| 106 | - if($default_mask != null) { |
|
| 106 | + if ($default_mask != null) { |
|
| 107 | 107 | $this->mask = $default_mask; |
| 108 | 108 | } |
| 109 | 109 | |
@@ -120,10 +120,10 @@ discard block |
||
| 120 | 120 | * @throws MethodNotFoundException |
| 121 | 121 | */ |
| 122 | 122 | public function __call($method, $arguments) { |
| 123 | - if(strtolower(substr($method, 0, 3)) === 'get') { |
|
| 123 | + if (strtolower(substr($method, 0, 3)) === 'get') { |
|
| 124 | 124 | $name = Str::snake(substr($method, 3)); |
| 125 | 125 | |
| 126 | - if(isset($this->attributes[$name])) { |
|
| 126 | + if (isset($this->attributes[$name])) { |
|
| 127 | 127 | return $this->attributes[$name]; |
| 128 | 128 | } |
| 129 | 129 | |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | * @return mixed|null |
| 160 | 160 | */ |
| 161 | 161 | public function __get($name) { |
| 162 | - if(isset($this->attributes[$name])) { |
|
| 162 | + if (isset($this->attributes[$name])) { |
|
| 163 | 163 | return $this->attributes[$name]; |
| 164 | 164 | } |
| 165 | 165 | |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | $this->setName($filename); |
| 223 | 223 | } elseif (($name = $this->part->name) !== null) { |
| 224 | 224 | $this->setName($name); |
| 225 | - }else { |
|
| 225 | + } else { |
|
| 226 | 226 | $this->setName("undefined"); |
| 227 | 227 | } |
| 228 | 228 | |
@@ -255,9 +255,9 @@ discard block |
||
| 255 | 255 | public function setName($name) { |
| 256 | 256 | $decoder = $this->config['decoder']['attachment']; |
| 257 | 257 | if ($name !== null) { |
| 258 | - if($decoder === 'utf-8' && extension_loaded('imap')) { |
|
| 258 | + if ($decoder === 'utf-8' && extension_loaded('imap')) { |
|
| 259 | 259 | $this->name = \imap_utf8($name); |
| 260 | - }else{ |
|
| 260 | + } else { |
|
| 261 | 261 | $this->name = mb_decode_mimeheader($name); |
| 262 | 262 | } |
| 263 | 263 | } |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | * |
| 269 | 269 | * @return string|null |
| 270 | 270 | */ |
| 271 | - public function getMimeType(){ |
|
| 271 | + public function getMimeType() { |
|
| 272 | 272 | return (new \finfo())->buffer($this->getContent(), FILEINFO_MIME_TYPE); |
| 273 | 273 | } |
| 274 | 274 | |
@@ -277,9 +277,9 @@ discard block |
||
| 277 | 277 | * |
| 278 | 278 | * @return string|null |
| 279 | 279 | */ |
| 280 | - public function getExtension(){ |
|
| 280 | + public function getExtension() { |
|
| 281 | 281 | $deprecated_guesser = "\Symfony\Component\HttpFoundation\File\MimeType\ExtensionGuesser"; |
| 282 | - if (class_exists($deprecated_guesser) !== false){ |
|
| 282 | + if (class_exists($deprecated_guesser) !== false) { |
|
| 283 | 283 | return $deprecated_guesser::getInstance()->guess($this->getMimeType()); |
| 284 | 284 | } |
| 285 | 285 | $guesser = "\Symfony\Component\Mime\MimeTypes"; |
@@ -292,14 +292,14 @@ discard block |
||
| 292 | 292 | * |
| 293 | 293 | * @return array |
| 294 | 294 | */ |
| 295 | - public function getAttributes(){ |
|
| 295 | + public function getAttributes() { |
|
| 296 | 296 | return $this->attributes; |
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | /** |
| 300 | 300 | * @return Message |
| 301 | 301 | */ |
| 302 | - public function getMessage(){ |
|
| 302 | + public function getMessage() { |
|
| 303 | 303 | return $this->oMessage; |
| 304 | 304 | } |
| 305 | 305 | |
@@ -309,8 +309,8 @@ discard block |
||
| 309 | 309 | * |
| 310 | 310 | * @return $this |
| 311 | 311 | */ |
| 312 | - public function setMask($mask){ |
|
| 313 | - if(class_exists($mask)){ |
|
| 312 | + public function setMask($mask) { |
|
| 313 | + if (class_exists($mask)) { |
|
| 314 | 314 | $this->mask = $mask; |
| 315 | 315 | } |
| 316 | 316 | |
@@ -322,7 +322,7 @@ discard block |
||
| 322 | 322 | * |
| 323 | 323 | * @return string |
| 324 | 324 | */ |
| 325 | - public function getMask(){ |
|
| 325 | + public function getMask() { |
|
| 326 | 326 | return $this->mask; |
| 327 | 327 | } |
| 328 | 328 | |
@@ -333,9 +333,9 @@ discard block |
||
| 333 | 333 | * @return mixed |
| 334 | 334 | * @throws MaskNotFoundException |
| 335 | 335 | */ |
| 336 | - public function mask($mask = null){ |
|
| 336 | + public function mask($mask = null) { |
|
| 337 | 337 | $mask = $mask !== null ? $mask : $this->mask; |
| 338 | - if(class_exists($mask)){ |
|
| 338 | + if (class_exists($mask)) { |
|
| 339 | 339 | return new $mask($this); |
| 340 | 340 | } |
| 341 | 341 | |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | public function __construct($parent) { |
| 44 | 44 | $this->parent = $parent; |
| 45 | 45 | |
| 46 | - if(method_exists($this->parent, 'getAttributes')){ |
|
| 46 | + if (method_exists($this->parent, 'getAttributes')) { |
|
| 47 | 47 | $this->attributes = array_merge($this->attributes, $this->parent->getAttributes()); |
| 48 | 48 | } |
| 49 | 49 | |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | /** |
| 54 | 54 | * Boot method made to be used by any custom mask |
| 55 | 55 | */ |
| 56 | - protected function boot(){} |
|
| 56 | + protected function boot() {} |
|
| 57 | 57 | |
| 58 | 58 | /** |
| 59 | 59 | * Call dynamic attribute setter and getter methods and inherit the parent calls |
@@ -64,17 +64,17 @@ discard block |
||
| 64 | 64 | * @throws MethodNotFoundException |
| 65 | 65 | */ |
| 66 | 66 | public function __call($method, $arguments) { |
| 67 | - if(strtolower(substr($method, 0, 3)) === 'get') { |
|
| 67 | + if (strtolower(substr($method, 0, 3)) === 'get') { |
|
| 68 | 68 | $name = Str::snake(substr($method, 3)); |
| 69 | 69 | |
| 70 | - if(isset($this->attributes[$name])) { |
|
| 70 | + if (isset($this->attributes[$name])) { |
|
| 71 | 71 | return $this->attributes[$name]; |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | }elseif (strtolower(substr($method, 0, 3)) === 'set') { |
| 75 | 75 | $name = Str::snake(substr($method, 3)); |
| 76 | 76 | |
| 77 | - if(isset($this->attributes[$name])) { |
|
| 77 | + if (isset($this->attributes[$name])) { |
|
| 78 | 78 | $this->attributes[$name] = array_pop($arguments); |
| 79 | 79 | |
| 80 | 80 | return $this->attributes[$name]; |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | - if(method_exists($this->parent, $method) === true){ |
|
| 85 | + if (method_exists($this->parent, $method) === true) { |
|
| 86 | 86 | return call_user_func_array([$this->parent, $method], $arguments); |
| 87 | 87 | } |
| 88 | 88 | |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | * @return mixed|null |
| 110 | 110 | */ |
| 111 | 111 | public function __get($name) { |
| 112 | - if(isset($this->attributes[$name])) { |
|
| 112 | + if (isset($this->attributes[$name])) { |
|
| 113 | 113 | return $this->attributes[$name]; |
| 114 | 114 | } |
| 115 | 115 | |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | * |
| 122 | 122 | * @return mixed |
| 123 | 123 | */ |
| 124 | - public function getParent(){ |
|
| 124 | + public function getParent() { |
|
| 125 | 125 | return $this->parent; |
| 126 | 126 | } |
| 127 | 127 | |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | * |
| 131 | 131 | * @return array |
| 132 | 132 | */ |
| 133 | - public function getAttributes(){ |
|
| 133 | + public function getAttributes() { |
|
| 134 | 134 | return $this->attributes; |
| 135 | 135 | } |
| 136 | 136 | |
@@ -30,13 +30,13 @@ discard block |
||
| 30 | 30 | * |
| 31 | 31 | * @return null |
| 32 | 32 | */ |
| 33 | - public function getHtmlBody(){ |
|
| 33 | + public function getHtmlBody() { |
|
| 34 | 34 | $bodies = $this->parent->getBodies(); |
| 35 | 35 | if (!isset($bodies['html'])) { |
| 36 | 36 | return null; |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | - if(is_object($bodies['html']) && property_exists($bodies['html'], 'content')) { |
|
| 39 | + if (is_object($bodies['html']) && property_exists($bodies['html'], 'content')) { |
|
| 40 | 40 | return $bodies['html']->content; |
| 41 | 41 | } |
| 42 | 42 | return $bodies['html']; |
@@ -50,15 +50,15 @@ discard block |
||
| 50 | 50 | */ |
| 51 | 51 | public function getCustomHTMLBody($callback = false) { |
| 52 | 52 | $body = $this->getHtmlBody(); |
| 53 | - if($body === null) return null; |
|
| 53 | + if ($body === null) return null; |
|
| 54 | 54 | |
| 55 | 55 | if ($callback !== false) { |
| 56 | 56 | $aAttachment = $this->parent->getAttachments(); |
| 57 | 57 | $aAttachment->each(function($oAttachment) use(&$body, $callback) { |
| 58 | 58 | /** @var Attachment $oAttachment */ |
| 59 | - if(is_callable($callback)) { |
|
| 59 | + if (is_callable($callback)) { |
|
| 60 | 60 | $body = $callback($body, $oAttachment); |
| 61 | - }elseif(is_string($callback)) { |
|
| 61 | + }elseif (is_string($callback)) { |
|
| 62 | 62 | call_user_func($callback, [$body, $oAttachment]); |
| 63 | 63 | } |
| 64 | 64 | }); |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | * @return string|null |
| 75 | 75 | */ |
| 76 | 76 | public function getHTMLBodyWithEmbeddedBase64Images() { |
| 77 | - return $this->getCustomHTMLBody(function($body, $oAttachment){ |
|
| 77 | + return $this->getCustomHTMLBody(function($body, $oAttachment) { |
|
| 78 | 78 | /** @var Attachment $oAttachment */ |
| 79 | 79 | if ($oAttachment->id) { |
| 80 | 80 | $body = str_replace('cid:'.$oAttachment->id, 'data:'.$oAttachment->getContentType().';base64, '.base64_encode($oAttachment->getContent()), $body); |
@@ -73,7 +73,7 @@ |
||
| 73 | 73 | * @return int|null |
| 74 | 74 | */ |
| 75 | 75 | public function total($total = null) { |
| 76 | - if($total === null) { |
|
| 76 | + if ($total === null) { |
|
| 77 | 77 | return $this->total; |
| 78 | 78 | } |
| 79 | 79 | |
@@ -38,11 +38,11 @@ discard block |
||
| 38 | 38 | * @param object $object |
| 39 | 39 | */ |
| 40 | 40 | public function __construct($object) { |
| 41 | - if (property_exists($object, "personal")){ $this->personal = $object->personal; } |
|
| 42 | - if (property_exists($object, "mailbox")){ $this->mailbox = $object->mailbox; } |
|
| 43 | - if (property_exists($object, "host")){ $this->host = $object->host; } |
|
| 44 | - if (property_exists($object, "mail")){ $this->mail = $object->mail; } |
|
| 45 | - if (property_exists($object, "full")){ $this->full = $object->full; } |
|
| 41 | + if (property_exists($object, "personal")) { $this->personal = $object->personal; } |
|
| 42 | + if (property_exists($object, "mailbox")) { $this->mailbox = $object->mailbox; } |
|
| 43 | + if (property_exists($object, "host")) { $this->host = $object->host; } |
|
| 44 | + if (property_exists($object, "mail")) { $this->mail = $object->mail; } |
|
| 45 | + if (property_exists($object, "full")) { $this->full = $object->full; } |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | * |
| 61 | 61 | * @return array |
| 62 | 62 | */ |
| 63 | - public function __serialize(){ |
|
| 63 | + public function __serialize() { |
|
| 64 | 64 | return [ |
| 65 | 65 | "personal" => $this->personal, |
| 66 | 66 | "mailbox" => $this->mailbox, |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | * |
| 76 | 76 | * @return array |
| 77 | 77 | */ |
| 78 | - public function toArray(){ |
|
| 78 | + public function toArray() { |
|
| 79 | 79 | return $this->__serialize(); |
| 80 | 80 | } |
| 81 | 81 | |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | * |
| 85 | 85 | * @return string |
| 86 | 86 | */ |
| 87 | - public function toString(){ |
|
| 87 | + public function toString() { |
|
| 88 | 88 | return $this->__toString(); |
| 89 | 89 | } |
| 90 | 90 | } |
| 91 | 91 | \ No newline at end of file |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | break; |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | - return (string)$value; |
|
| 129 | + return (string) $value; |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | /** |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | if ($statement[1] === null) { |
| 163 | 163 | $query .= $statement[0]; |
| 164 | 164 | } else { |
| 165 | - $query .= $statement[0] . ' "' . $statement[1] . '"'; |
|
| 165 | + $query .= $statement[0].' "'.$statement[1].'"'; |
|
| 166 | 166 | } |
| 167 | 167 | } |
| 168 | 168 | $query .= ' '; |
@@ -247,18 +247,18 @@ discard block |
||
| 247 | 247 | * @throws GetMessagesFailedException |
| 248 | 248 | * @throws ReflectionException |
| 249 | 249 | */ |
| 250 | - protected function make($uid, $msglist, $header, $content, $flags){ |
|
| 250 | + protected function make($uid, $msglist, $header, $content, $flags) { |
|
| 251 | 251 | try { |
| 252 | 252 | return Message::make($uid, $msglist, $this->getClient(), $header, $content, $flags, $this->getFetchOptions(), $this->sequence); |
| 253 | - }catch (MessageNotFoundException $e) { |
|
| 253 | + } catch (MessageNotFoundException $e) { |
|
| 254 | 254 | $this->setError($uid, $e); |
| 255 | - }catch (RuntimeException $e) { |
|
| 255 | + } catch (RuntimeException $e) { |
|
| 256 | 256 | $this->setError($uid, $e); |
| 257 | - }catch (MessageFlagException $e) { |
|
| 257 | + } catch (MessageFlagException $e) { |
|
| 258 | 258 | $this->setError($uid, $e); |
| 259 | - }catch (InvalidMessageDateException $e) { |
|
| 259 | + } catch (InvalidMessageDateException $e) { |
|
| 260 | 260 | $this->setError($uid, $e); |
| 261 | - }catch (MessageContentFetchingException $e) { |
|
| 261 | + } catch (MessageContentFetchingException $e) { |
|
| 262 | 262 | $this->setError($uid, $e); |
| 263 | 263 | } |
| 264 | 264 | |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | * |
| 276 | 276 | * @return string |
| 277 | 277 | */ |
| 278 | - protected function getMessageKey($message_key, $msglist, $message){ |
|
| 278 | + protected function getMessageKey($message_key, $msglist, $message) { |
|
| 279 | 279 | switch ($message_key) { |
| 280 | 280 | case 'number': |
| 281 | 281 | $key = $message->getMessageNo(); |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | $key = $message->getMessageId(); |
| 291 | 291 | break; |
| 292 | 292 | } |
| 293 | - return (string)$key; |
|
| 293 | + return (string) $key; |
|
| 294 | 294 | } |
| 295 | 295 | |
| 296 | 296 | /** |
@@ -782,7 +782,7 @@ discard block |
||
| 782 | 782 | * |
| 783 | 783 | * @return boolean |
| 784 | 784 | */ |
| 785 | - public function hasErrors($uid = null){ |
|
| 785 | + public function hasErrors($uid = null) { |
|
| 786 | 786 | if ($uid !== null) { |
| 787 | 787 | return $this->hasError($uid); |
| 788 | 788 | } |
@@ -795,7 +795,7 @@ discard block |
||
| 795 | 795 | * |
| 796 | 796 | * @return boolean |
| 797 | 797 | */ |
| 798 | - public function hasError($uid){ |
|
| 798 | + public function hasError($uid) { |
|
| 799 | 799 | return isset($this->errors[$uid]); |
| 800 | 800 | } |
| 801 | 801 | |
@@ -804,7 +804,7 @@ discard block |
||
| 804 | 804 | * |
| 805 | 805 | * @return array |
| 806 | 806 | */ |
| 807 | - public function errors(){ |
|
| 807 | + public function errors() { |
|
| 808 | 808 | return $this->getErrors(); |
| 809 | 809 | } |
| 810 | 810 | |
@@ -813,7 +813,7 @@ discard block |
||
| 813 | 813 | * |
| 814 | 814 | * @return array |
| 815 | 815 | */ |
| 816 | - public function getErrors(){ |
|
| 816 | + public function getErrors() { |
|
| 817 | 817 | return $this->errors; |
| 818 | 818 | } |
| 819 | 819 | |
@@ -823,7 +823,7 @@ discard block |
||
| 823 | 823 | * |
| 824 | 824 | * @return Exception|null |
| 825 | 825 | */ |
| 826 | - public function error($uid){ |
|
| 826 | + public function error($uid) { |
|
| 827 | 827 | return $this->getError($uid); |
| 828 | 828 | } |
| 829 | 829 | |
@@ -833,7 +833,7 @@ discard block |
||
| 833 | 833 | * |
| 834 | 834 | * @return Exception|null |
| 835 | 835 | */ |
| 836 | - public function getError($uid){ |
|
| 836 | + public function getError($uid) { |
|
| 837 | 837 | if ($this->hasError($uid)) { |
| 838 | 838 | return $this->errors[$uid]; |
| 839 | 839 | } |