@@ -16,7 +16,7 @@ |
||
| 16 | 16 | * New custom method which can be called through a mask |
| 17 | 17 | * @return string |
| 18 | 18 | */ |
| 19 | - public function token(){ |
|
| 19 | + public function token() { |
|
| 20 | 20 | return implode('-', [$this->message_id, $this->uid, $this->message_no]); |
| 21 | 21 | } |
| 22 | 22 | |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | * New custom method which can be called through a mask |
| 17 | 17 | * @return string |
| 18 | 18 | */ |
| 19 | - public function token(){ |
|
| 19 | + public function token() { |
|
| 20 | 20 | return implode('-', [$this->id, $this->getMessage()->getUid(), $this->name]); |
| 21 | 21 | } |
| 22 | 22 | |
@@ -69,7 +69,7 @@ |
||
| 69 | 69 | * @return int|null |
| 70 | 70 | */ |
| 71 | 71 | public function total($total = null) { |
| 72 | - if($total === null) { |
|
| 72 | + if ($total === null) { |
|
| 73 | 73 | return $this->total; |
| 74 | 74 | } |
| 75 | 75 | |
@@ -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 | |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | * |
| 211 | 211 | * @return array |
| 212 | 212 | */ |
| 213 | - public function headers($uids, $rfc = "RFC822"){ |
|
| 213 | + public function headers($uids, $rfc = "RFC822") { |
|
| 214 | 214 | $headers = \imap_fetchheader($this->stream, $uids[0], IMAP::FT_UID); |
| 215 | 215 | return [$uids[0] => $headers]; |
| 216 | 216 | } |
@@ -221,13 +221,13 @@ discard block |
||
| 221 | 221 | * |
| 222 | 222 | * @return array |
| 223 | 223 | */ |
| 224 | - public function flags($uids){ |
|
| 224 | + public function flags($uids) { |
|
| 225 | 225 | $flags = \imap_fetch_overview($this->stream, $uids[0], IMAP::FT_UID); |
| 226 | 226 | $result = []; |
| 227 | 227 | if (is_array($flags) && isset($flags[0])) { |
| 228 | 228 | $flags = (array) $flags[0]; |
| 229 | - foreach($flags as $flag => $value) { |
|
| 230 | - if ($value === 1 && in_array($flag, ["size", "uid", "msgno", "update"]) === false){ |
|
| 229 | + foreach ($flags as $flag => $value) { |
|
| 230 | + if ($value === 1 && in_array($flag, ["size", "uid", "msgno", "update"]) === false) { |
|
| 231 | 231 | $result[] = "\\".ucfirst($flag); |
| 232 | 232 | } |
| 233 | 233 | } |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | if ($id === null) { |
| 246 | 246 | $overview = $this->overview("1:*"); |
| 247 | 247 | $uids = []; |
| 248 | - foreach($overview as $set){ |
|
| 248 | + foreach ($overview as $set) { |
|
| 249 | 249 | $uids[$set->msgno] = $set->uid; |
| 250 | 250 | } |
| 251 | 251 | return $uids; |
@@ -285,12 +285,12 @@ discard block |
||
| 285 | 285 | $result = []; |
| 286 | 286 | |
| 287 | 287 | $items = \imap_getmailboxes($this->stream, $this->getAddress(), $reference.$folder); |
| 288 | - if(is_array($items)){ |
|
| 288 | + if (is_array($items)) { |
|
| 289 | 289 | foreach ($items as $item) { |
| 290 | 290 | $name = $this->decodeFolderName($item->name); |
| 291 | 291 | $result[$name] = ['delimiter' => $item->delimiter, 'flags' => []]; |
| 292 | 292 | } |
| 293 | - }else{ |
|
| 293 | + }else { |
|
| 294 | 294 | throw new RuntimeException(\imap_last_error()); |
| 295 | 295 | } |
| 296 | 296 | |
@@ -311,9 +311,9 @@ discard block |
||
| 311 | 311 | public function store(array $flags, $from, $to = null, $mode = null, $silent = true) { |
| 312 | 312 | $flag = "\\".trim(is_array($flags) ? implode(" \\", $flags) : $flags); |
| 313 | 313 | |
| 314 | - if ($mode == "+"){ |
|
| 314 | + if ($mode == "+") { |
|
| 315 | 315 | $status = \imap_setflag_full($this->stream, $from, $flag, IMAP::SE_UID); |
| 316 | - }else{ |
|
| 316 | + }else { |
|
| 317 | 317 | $status = \imap_clearflag_full($this->stream, $from, $flag, IMAP::SE_UID); |
| 318 | 318 | } |
| 319 | 319 | |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | */ |
| 336 | 336 | public function appendMessage($folder, $message, $flags = null, $date = null) { |
| 337 | 337 | if ($date != null) { |
| 338 | - if ($date instanceof \Carbon\Carbon){ |
|
| 338 | + if ($date instanceof \Carbon\Carbon) { |
|
| 339 | 339 | $date = $date->format('d-M-Y H:i:s O'); |
| 340 | 340 | } |
| 341 | 341 | return \imap_append($this->stream, $folder, $message, $flags, $date); |
@@ -457,14 +457,14 @@ discard block |
||
| 457 | 457 | /** |
| 458 | 458 | * Enable the debug mode |
| 459 | 459 | */ |
| 460 | - public function enableDebug(){ |
|
| 460 | + public function enableDebug() { |
|
| 461 | 461 | $this->debug = true; |
| 462 | 462 | } |
| 463 | 463 | |
| 464 | 464 | /** |
| 465 | 465 | * Disable the debug mode |
| 466 | 466 | */ |
| 467 | - public function disableDebug(){ |
|
| 467 | + public function disableDebug() { |
|
| 468 | 468 | $this->debug = false; |
| 469 | 469 | } |
| 470 | 470 | |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | * @throws ConnectionFailedException |
| 83 | 83 | * @throws RuntimeException |
| 84 | 84 | */ |
| 85 | - protected function enableTls(){ |
|
| 85 | + protected function enableTls() { |
|
| 86 | 86 | $response = $this->requestAndResponse('STARTTLS'); |
| 87 | 87 | $result = $response && stream_socket_enable_crypto($this->stream, true, $this->getCryptoMethod()); |
| 88 | 88 | if (!$result) { |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | $stack = []; |
| 145 | 145 | |
| 146 | 146 | // replace any trailing <NL> including spaces with a single space |
| 147 | - $line = rtrim($line) . ' '; |
|
| 147 | + $line = rtrim($line).' '; |
|
| 148 | 148 | while (($pos = strpos($line, ' ')) !== false) { |
| 149 | 149 | $token = substr($line, 0, $pos); |
| 150 | 150 | if (!strlen($token)) { |
@@ -174,11 +174,11 @@ discard block |
||
| 174 | 174 | if (strlen($token) > $chars) { |
| 175 | 175 | $line = substr($token, $chars); |
| 176 | 176 | $token = substr($token, 0, $chars); |
| 177 | - } else { |
|
| 177 | + }else { |
|
| 178 | 178 | $line .= $this->nextLine(); |
| 179 | 179 | } |
| 180 | 180 | $tokens[] = $token; |
| 181 | - $line = trim($line) . ' '; |
|
| 181 | + $line = trim($line).' '; |
|
| 182 | 182 | continue; |
| 183 | 183 | } |
| 184 | 184 | } |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | $line = $this->nextTaggedLine($tag); // get next tag |
| 229 | 229 | if (!$dontParse) { |
| 230 | 230 | $tokens = $this->decodeLine($line); |
| 231 | - } else { |
|
| 231 | + }else { |
|
| 232 | 232 | $tokens = $line; |
| 233 | 233 | } |
| 234 | 234 | |
@@ -255,9 +255,9 @@ discard block |
||
| 255 | 255 | // last to chars are still needed for response code |
| 256 | 256 | $tokens = [substr($tokens, 0, 2)]; |
| 257 | 257 | } |
| 258 | - if (is_array($lines)){ |
|
| 258 | + if (is_array($lines)) { |
|
| 259 | 259 | if ($this->debug) echo "<< ".json_encode($lines)."\n"; |
| 260 | - }else{ |
|
| 260 | + }else { |
|
| 261 | 261 | if ($this->debug) echo "<< ".$lines."\n"; |
| 262 | 262 | } |
| 263 | 263 | // last line has response code |
@@ -280,27 +280,27 @@ discard block |
||
| 280 | 280 | public function sendRequest($command, $tokens = [], &$tag = null) { |
| 281 | 281 | if (!$tag) { |
| 282 | 282 | $this->noun++; |
| 283 | - $tag = 'TAG' . $this->noun; |
|
| 283 | + $tag = 'TAG'.$this->noun; |
|
| 284 | 284 | } |
| 285 | 285 | |
| 286 | - $line = $tag . ' ' . $command; |
|
| 286 | + $line = $tag.' '.$command; |
|
| 287 | 287 | |
| 288 | 288 | foreach ($tokens as $token) { |
| 289 | 289 | if (is_array($token)) { |
| 290 | - if (fwrite($this->stream, $line . ' ' . $token[0] . "\r\n") === false) { |
|
| 290 | + if (fwrite($this->stream, $line.' '.$token[0]."\r\n") === false) { |
|
| 291 | 291 | throw new RuntimeException('failed to write - connection closed?'); |
| 292 | 292 | } |
| 293 | 293 | if (!$this->assumedNextLine('+ ')) { |
| 294 | 294 | throw new RuntimeException('failed to send literal string'); |
| 295 | 295 | } |
| 296 | 296 | $line = $token[1]; |
| 297 | - } else { |
|
| 298 | - $line .= ' ' . $token; |
|
| 297 | + }else { |
|
| 298 | + $line .= ' '.$token; |
|
| 299 | 299 | } |
| 300 | 300 | } |
| 301 | 301 | if ($this->debug) echo ">> ".$line."\n"; |
| 302 | 302 | |
| 303 | - if (fwrite($this->stream, $line . "\r\n") === false) { |
|
| 303 | + if (fwrite($this->stream, $line."\r\n") === false) { |
|
| 304 | 304 | throw new RuntimeException('failed to write - connection closed?'); |
| 305 | 305 | } |
| 306 | 306 | } |
@@ -330,9 +330,9 @@ discard block |
||
| 330 | 330 | public function escapeString($string) { |
| 331 | 331 | if (func_num_args() < 2) { |
| 332 | 332 | if (strpos($string, "\n") !== false) { |
| 333 | - return ['{' . strlen($string) . '}', $string]; |
|
| 334 | - } else { |
|
| 335 | - return '"' . str_replace(['\\', '"'], ['\\\\', '\\"'], $string) . '"'; |
|
| 333 | + return ['{'.strlen($string).'}', $string]; |
|
| 334 | + }else { |
|
| 335 | + return '"'.str_replace(['\\', '"'], ['\\\\', '\\"'], $string).'"'; |
|
| 336 | 336 | } |
| 337 | 337 | } |
| 338 | 338 | $result = []; |
@@ -357,7 +357,7 @@ discard block |
||
| 357 | 357 | } |
| 358 | 358 | $result[] = $this->escapeList($v); |
| 359 | 359 | } |
| 360 | - return '(' . implode(' ', $result) . ')'; |
|
| 360 | + return '('.implode(' ', $result).')'; |
|
| 361 | 361 | } |
| 362 | 362 | |
| 363 | 363 | /** |
@@ -397,12 +397,12 @@ discard block |
||
| 397 | 397 | error_log("got an extra server challenge: $response"); |
| 398 | 398 | // respond with an empty response. |
| 399 | 399 | $this->sendRequest(''); |
| 400 | - } else { |
|
| 400 | + }else { |
|
| 401 | 401 | if (preg_match('/^NO /i', $response) || |
| 402 | 402 | preg_match('/^BAD /i', $response)) { |
| 403 | 403 | error_log("got failure response: $response"); |
| 404 | 404 | return false; |
| 405 | - } else if (preg_match("/^OK /i", $response)) { |
|
| 405 | + }else if (preg_match("/^OK /i", $response)) { |
|
| 406 | 406 | return true; |
| 407 | 407 | } |
| 408 | 408 | } |
@@ -435,7 +435,7 @@ discard block |
||
| 435 | 435 | * |
| 436 | 436 | * @return bool |
| 437 | 437 | */ |
| 438 | - public function connected(){ |
|
| 438 | + public function connected() { |
|
| 439 | 439 | return (boolean) $this->stream; |
| 440 | 440 | } |
| 441 | 441 | |
@@ -482,10 +482,10 @@ discard block |
||
| 482 | 482 | $result[strtolower($tokens[1])] = $tokens[0]; |
| 483 | 483 | break; |
| 484 | 484 | case '[UIDVALIDITY': |
| 485 | - $result['uidvalidity'] = (int)$tokens[2]; |
|
| 485 | + $result['uidvalidity'] = (int) $tokens[2]; |
|
| 486 | 486 | break; |
| 487 | 487 | case '[UIDNEXT': |
| 488 | - $result['uidnext'] = (int)$tokens[2]; |
|
| 488 | + $result['uidnext'] = (int) $tokens[2]; |
|
| 489 | 489 | break; |
| 490 | 490 | default: |
| 491 | 491 | // ignore |
@@ -539,17 +539,17 @@ discard block |
||
| 539 | 539 | if (is_array($from)) { |
| 540 | 540 | $set = implode(',', $from); |
| 541 | 541 | } elseif ($to === null) { |
| 542 | - $set = (int)$from; |
|
| 542 | + $set = (int) $from; |
|
| 543 | 543 | } elseif ($to === INF) { |
| 544 | - $set = (int)$from . ':*'; |
|
| 545 | - } else { |
|
| 546 | - $set = (int)$from . ':' . (int)$to; |
|
| 544 | + $set = (int) $from.':*'; |
|
| 545 | + }else { |
|
| 546 | + $set = (int) $from.':'.(int) $to; |
|
| 547 | 547 | } |
| 548 | 548 | |
| 549 | - $items = (array)$items; |
|
| 549 | + $items = (array) $items; |
|
| 550 | 550 | $itemList = $this->escapeList($items); |
| 551 | 551 | |
| 552 | - $this->sendRequest(($uid ? 'UID ' : '') . 'FETCH', [$set, $itemList], $tag); |
|
| 552 | + $this->sendRequest(($uid ? 'UID ' : '').'FETCH', [$set, $itemList], $tag); |
|
| 553 | 553 | |
| 554 | 554 | $result = []; |
| 555 | 555 | $tokens = null; // define $tokens variable before first use |
@@ -564,7 +564,7 @@ discard block |
||
| 564 | 564 | $count = count($tokens[2]); |
| 565 | 565 | if ($tokens[2][$count - 2] == 'UID') { |
| 566 | 566 | $uidKey = $count - 1; |
| 567 | - } else { |
|
| 567 | + }else { |
|
| 568 | 568 | $uidKey = array_search('UID', $tokens[2]) + 1; |
| 569 | 569 | } |
| 570 | 570 | } |
@@ -580,7 +580,7 @@ discard block |
||
| 580 | 580 | $data = $tokens[2][1]; |
| 581 | 581 | } elseif ($uid && $tokens[2][2] == $items[0]) { |
| 582 | 582 | $data = $tokens[2][3]; |
| 583 | - } else { |
|
| 583 | + }else { |
|
| 584 | 584 | // maybe the server send an other field we didn't wanted |
| 585 | 585 | $count = count($tokens[2]); |
| 586 | 586 | // we start with 2, because 0 was already checked |
@@ -592,7 +592,7 @@ discard block |
||
| 592 | 592 | break; |
| 593 | 593 | } |
| 594 | 594 | } |
| 595 | - } else { |
|
| 595 | + }else { |
|
| 596 | 596 | $data = []; |
| 597 | 597 | while (key($tokens[2]) !== null) { |
| 598 | 598 | $data[current($tokens[2])] = next($tokens[2]); |
@@ -637,7 +637,7 @@ discard block |
||
| 637 | 637 | * @return array |
| 638 | 638 | * @throws RuntimeException |
| 639 | 639 | */ |
| 640 | - public function headers($uids, $rfc = "RFC822"){ |
|
| 640 | + public function headers($uids, $rfc = "RFC822") { |
|
| 641 | 641 | return $this->fetch(["$rfc.HEADER"], $uids); |
| 642 | 642 | } |
| 643 | 643 | |
@@ -648,7 +648,7 @@ discard block |
||
| 648 | 648 | * @return array |
| 649 | 649 | * @throws RuntimeException |
| 650 | 650 | */ |
| 651 | - public function flags($uids){ |
|
| 651 | + public function flags($uids) { |
|
| 652 | 652 | return $this->fetch(["FLAGS"], $uids); |
| 653 | 653 | } |
| 654 | 654 | |
@@ -732,22 +732,22 @@ discard block |
||
| 732 | 732 | public function store(array $flags, $from, $to = null, $mode = null, $silent = true) { |
| 733 | 733 | $item = 'FLAGS'; |
| 734 | 734 | if ($mode == '+' || $mode == '-') { |
| 735 | - $item = $mode . $item; |
|
| 735 | + $item = $mode.$item; |
|
| 736 | 736 | } |
| 737 | 737 | if ($silent) { |
| 738 | 738 | $item .= '.SILENT'; |
| 739 | 739 | } |
| 740 | 740 | |
| 741 | 741 | $flags = $this->escapeList($flags); |
| 742 | - $set = (int)$from; |
|
| 742 | + $set = (int) $from; |
|
| 743 | 743 | if ($to !== null) { |
| 744 | - $set .= ':' . ($to == INF ? '*' : (int)$to); |
|
| 744 | + $set .= ':'.($to == INF ? '*' : (int) $to); |
|
| 745 | 745 | } |
| 746 | 746 | |
| 747 | 747 | $result = $this->requestAndResponse('STORE', [$set, $item, $flags], $silent); |
| 748 | 748 | |
| 749 | 749 | if ($silent) { |
| 750 | - return (bool)$result; |
|
| 750 | + return (bool) $result; |
|
| 751 | 751 | } |
| 752 | 752 | |
| 753 | 753 | $tokens = $result; |
@@ -797,9 +797,9 @@ discard block |
||
| 797 | 797 | * @throws RuntimeException |
| 798 | 798 | */ |
| 799 | 799 | public function copyMessage($folder, $from, $to = null) { |
| 800 | - $set = (int)$from; |
|
| 800 | + $set = (int) $from; |
|
| 801 | 801 | if ($to !== null) { |
| 802 | - $set .= ':' . ($to == INF ? '*' : (int)$to); |
|
| 802 | + $set .= ':'.($to == INF ? '*' : (int) $to); |
|
| 803 | 803 | } |
| 804 | 804 | |
| 805 | 805 | return $this->requestAndResponse('COPY', [$set, $this->escapeString($folder)], true); |
@@ -950,14 +950,14 @@ discard block |
||
| 950 | 950 | /** |
| 951 | 951 | * Enable the debug mode |
| 952 | 952 | */ |
| 953 | - public function enableDebug(){ |
|
| 953 | + public function enableDebug() { |
|
| 954 | 954 | $this->debug = true; |
| 955 | 955 | } |
| 956 | 956 | |
| 957 | 957 | /** |
| 958 | 958 | * Disable the debug mode |
| 959 | 959 | */ |
| 960 | - public function disableDebug(){ |
|
| 960 | + public function disableDebug() { |
|
| 961 | 961 | $this->debug = false; |
| 962 | 962 | } |
| 963 | 963 | } |
| 964 | 964 | \ No newline at end of file |
@@ -65,7 +65,7 @@ |
||
| 65 | 65 | * |
| 66 | 66 | * @return array |
| 67 | 67 | */ |
| 68 | - public function getEvents(){ |
|
| 68 | + public function getEvents() { |
|
| 69 | 69 | return $this->events; |
| 70 | 70 | } |
| 71 | 71 | |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | public function __construct(Client $client, $charset = 'UTF-8') { |
| 74 | 74 | $this->setClient($client); |
| 75 | 75 | |
| 76 | - if(ClientManager::get('options.fetch') === IMAP::FT_PEEK) $this->leaveUnread(); |
|
| 76 | + if (ClientManager::get('options.fetch') === IMAP::FT_PEEK) $this->leaveUnread(); |
|
| 77 | 77 | |
| 78 | 78 | $this->date_format = ClientManager::get('date_format', 'd M y'); |
| 79 | 79 | |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | /** |
| 86 | 86 | * Instance boot method for additional functionality |
| 87 | 87 | */ |
| 88 | - protected function boot(){} |
|
| 88 | + protected function boot() {} |
|
| 89 | 89 | |
| 90 | 90 | /** |
| 91 | 91 | * Parse a given value |
@@ -93,8 +93,8 @@ discard block |
||
| 93 | 93 | * |
| 94 | 94 | * @return string |
| 95 | 95 | */ |
| 96 | - protected function parse_value($value){ |
|
| 97 | - switch(true){ |
|
| 96 | + protected function parse_value($value) { |
|
| 97 | + switch (true) { |
|
| 98 | 98 | case $value instanceof \Carbon\Carbon: |
| 99 | 99 | $value = $value->format($this->date_format); |
| 100 | 100 | break; |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | * @throws MessageSearchValidationException |
| 112 | 112 | */ |
| 113 | 113 | protected function parse_date($date) { |
| 114 | - if($date instanceof \Carbon\Carbon) return $date; |
|
| 114 | + if ($date instanceof \Carbon\Carbon) return $date; |
|
| 115 | 115 | |
| 116 | 116 | try { |
| 117 | 117 | $date = Carbon::parse($date); |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | * @return Collection |
| 151 | 151 | * @throws GetMessagesFailedException |
| 152 | 152 | */ |
| 153 | - protected function search(){ |
|
| 153 | + protected function search() { |
|
| 154 | 154 | $this->generate_query(); |
| 155 | 155 | |
| 156 | 156 | try { |
@@ -195,15 +195,15 @@ discard block |
||
| 195 | 195 | |
| 196 | 196 | $options = ClientManager::get('options'); |
| 197 | 197 | |
| 198 | - if(strtolower($options['fetch_order']) === 'desc'){ |
|
| 198 | + if (strtolower($options['fetch_order']) === 'desc') { |
|
| 199 | 199 | $available_messages = $available_messages->reverse(); |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | - $query =& $this; |
|
| 202 | + $query = & $this; |
|
| 203 | 203 | |
| 204 | 204 | $available_messages->forPage($this->page, $this->limit)->each(function($msgno, $msglist) use(&$messages, $options, $query) { |
| 205 | 205 | $message = $query->getMessage($msgno, $msglist); |
| 206 | - switch ($options['message_key']){ |
|
| 206 | + switch ($options['message_key']) { |
|
| 207 | 207 | case 'number': |
| 208 | 208 | $message_key = $message->getMessageNo(); |
| 209 | 209 | break; |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | |
| 222 | 222 | return $messages; |
| 223 | 223 | } catch (\Exception $e) { |
| 224 | - throw new GetMessagesFailedException($e->getMessage(),0, $e); |
|
| 224 | + throw new GetMessagesFailedException($e->getMessage(), 0, $e); |
|
| 225 | 225 | } |
| 226 | 226 | } |
| 227 | 227 | |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | * @throws MessageContentFetchingException |
| 238 | 238 | * @throws MessageHeaderFetchingException |
| 239 | 239 | */ |
| 240 | - public function getMessage($msgno, $msglist = null){ |
|
| 240 | + public function getMessage($msgno, $msglist = null) { |
|
| 241 | 241 | return new Message($msgno, $msglist, $this->getClient(), $this->getFetchOptions(), $this->getFetchBody(), $this->getFetchFlags()); |
| 242 | 242 | } |
| 243 | 243 | |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | * @return LengthAwarePaginator |
| 251 | 251 | * @throws GetMessagesFailedException |
| 252 | 252 | */ |
| 253 | - public function paginate($per_page = 5, $page = null, $page_name = 'imap_page'){ |
|
| 253 | + public function paginate($per_page = 5, $page = null, $page_name = 'imap_page') { |
|
| 254 | 254 | $this->page = $page > $this->page ? $page : $this->page; |
| 255 | 255 | $this->limit = $per_page; |
| 256 | 256 | |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | $messages->each(function($message) use(&$collection){ |
| 262 | 262 | $collection[] = $message; |
| 263 | 263 | }); |
| 264 | - }else{ |
|
| 264 | + }else { |
|
| 265 | 265 | $collection = array_fill(0, $messages->total(), true); |
| 266 | 266 | } |
| 267 | 267 | |
@@ -278,10 +278,10 @@ discard block |
||
| 278 | 278 | $this->query->each(function($statement) use(&$query) { |
| 279 | 279 | if (count($statement) == 1) { |
| 280 | 280 | $query .= $statement[0]; |
| 281 | - } else { |
|
| 282 | - if($statement[1] === null){ |
|
| 281 | + }else { |
|
| 282 | + if ($statement[1] === null) { |
|
| 283 | 283 | $query .= $statement[0]; |
| 284 | - }else{ |
|
| 284 | + }else { |
|
| 285 | 285 | $query .= $statement[0].' "'.$statement[1].'"'; |
| 286 | 286 | } |
| 287 | 287 | } |
@@ -311,7 +311,7 @@ discard block |
||
| 311 | 311 | * @return $this |
| 312 | 312 | */ |
| 313 | 313 | public function limit($limit, $page = 1) { |
| 314 | - if($page >= 1) $this->page = $page; |
|
| 314 | + if ($page >= 1) $this->page = $page; |
|
| 315 | 315 | $this->limit = $limit; |
| 316 | 316 | |
| 317 | 317 | return $this; |
@@ -76,18 +76,18 @@ discard block |
||
| 76 | 76 | |
| 77 | 77 | $name = Str::camel($name); |
| 78 | 78 | |
| 79 | - if(strtolower(substr($name, 0, 3)) === 'not') { |
|
| 79 | + if (strtolower(substr($name, 0, 3)) === 'not') { |
|
| 80 | 80 | $that = $that->whereNot(); |
| 81 | 81 | $name = substr($name, 3); |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - if (strpos(strtolower($name), "where") === false){ |
|
| 84 | + if (strpos(strtolower($name), "where") === false) { |
|
| 85 | 85 | $method = 'where'.ucfirst($name); |
| 86 | - }else{ |
|
| 86 | + }else { |
|
| 87 | 87 | $method = lcfirst($name); |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - if(method_exists($this, $method) === true){ |
|
| 90 | + if (method_exists($this, $method) === true) { |
|
| 91 | 91 | return call_user_func_array([$that, $method], $arguments); |
| 92 | 92 | } |
| 93 | 93 | |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | if (substr($criteria, 0, 7) === "CUSTOM ") { |
| 107 | 107 | return substr($criteria, 7); |
| 108 | 108 | } |
| 109 | - if(in_array($criteria, $this->available_criteria) === false) { |
|
| 109 | + if (in_array($criteria, $this->available_criteria) === false) { |
|
| 110 | 110 | throw new InvalidWhereQueryCriteriaException(); |
| 111 | 111 | } |
| 112 | 112 | |
@@ -121,20 +121,20 @@ discard block |
||
| 121 | 121 | * @throws InvalidWhereQueryCriteriaException |
| 122 | 122 | */ |
| 123 | 123 | public function where($criteria, $value = null) { |
| 124 | - if(is_array($criteria)){ |
|
| 125 | - foreach($criteria as $key => $value){ |
|
| 126 | - if(is_numeric($key)){ |
|
| 124 | + if (is_array($criteria)) { |
|
| 125 | + foreach ($criteria as $key => $value) { |
|
| 126 | + if (is_numeric($key)) { |
|
| 127 | 127 | return $this->where($value); |
| 128 | 128 | } |
| 129 | 129 | return $this->where($key, $value); |
| 130 | 130 | } |
| 131 | - }else{ |
|
| 131 | + }else { |
|
| 132 | 132 | $criteria = $this->validate_criteria($criteria); |
| 133 | 133 | $value = $this->parse_value($value); |
| 134 | 134 | |
| 135 | - if($value === null || $value === ''){ |
|
| 135 | + if ($value === null || $value === '') { |
|
| 136 | 136 | $this->query->push([$criteria]); |
| 137 | - }else{ |
|
| 137 | + }else { |
|
| 138 | 138 | $this->query->push([$criteria, $value]); |
| 139 | 139 | } |
| 140 | 140 | } |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | */ |
| 150 | 150 | public function orWhere(\Closure $closure = null) { |
| 151 | 151 | $this->query->push(['OR']); |
| 152 | - if($closure !== null) $closure($this); |
|
| 152 | + if ($closure !== null) $closure($this); |
|
| 153 | 153 | |
| 154 | 154 | return $this; |
| 155 | 155 | } |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | */ |
| 162 | 162 | public function andWhere(\Closure $closure = null) { |
| 163 | 163 | $this->query->push(['AND']); |
| 164 | - if($closure !== null) $closure($this); |
|
| 164 | + if ($closure !== null) $closure($this); |
|
| 165 | 165 | |
| 166 | 166 | return $this; |
| 167 | 167 | } |
@@ -401,7 +401,7 @@ discard block |
||
| 401 | 401 | * @return WhereQuery |
| 402 | 402 | * @throws InvalidWhereQueryCriteriaException |
| 403 | 403 | */ |
| 404 | - public function whereNoXSpam(){ |
|
| 404 | + public function whereNoXSpam() { |
|
| 405 | 405 | return $this->where("CUSTOM X-Spam-Flag NO"); |
| 406 | 406 | } |
| 407 | 407 | |
@@ -409,7 +409,7 @@ discard block |
||
| 409 | 409 | * @return WhereQuery |
| 410 | 410 | * @throws InvalidWhereQueryCriteriaException |
| 411 | 411 | */ |
| 412 | - public function whereIsXSpam(){ |
|
| 412 | + public function whereIsXSpam() { |
|
| 413 | 413 | return $this->where("CUSTOM X-Spam-Flag YES"); |
| 414 | 414 | } |
| 415 | 415 | |
@@ -419,7 +419,7 @@ discard block |
||
| 419 | 419 | * @return WhereQuery |
| 420 | 420 | * @throws InvalidWhereQueryCriteriaException |
| 421 | 421 | */ |
| 422 | - public function whereLanguage($country_code){ |
|
| 422 | + public function whereLanguage($country_code) { |
|
| 423 | 423 | return $this->where("Content-Language $country_code"); |
| 424 | 424 | } |
| 425 | 425 | } |
| 426 | 426 | \ No newline at end of file |
@@ -68,17 +68,17 @@ discard block |
||
| 68 | 68 | public static function get($key, $default = null) { |
| 69 | 69 | $parts = explode('.', $key); |
| 70 | 70 | $value = null; |
| 71 | - foreach($parts as $part) { |
|
| 72 | - if($value === null) { |
|
| 73 | - if(isset(self::$config[$part])) { |
|
| 71 | + foreach ($parts as $part) { |
|
| 72 | + if ($value === null) { |
|
| 73 | + if (isset(self::$config[$part])) { |
|
| 74 | 74 | $value = self::$config[$part]; |
| 75 | - }else{ |
|
| 75 | + }else { |
|
| 76 | 76 | break; |
| 77 | 77 | } |
| 78 | - }else{ |
|
| 79 | - if(isset($value[$part])) { |
|
| 78 | + }else { |
|
| 79 | + if (isset($value[$part])) { |
|
| 80 | 80 | $value = $value[$part]; |
| 81 | - }else{ |
|
| 81 | + }else { |
|
| 82 | 82 | break; |
| 83 | 83 | } |
| 84 | 84 | } |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | */ |
| 172 | 172 | public function setConfig($config) { |
| 173 | 173 | |
| 174 | - if(is_array($config) === false) { |
|
| 174 | + if (is_array($config) === false) { |
|
| 175 | 175 | $config = require $config; |
| 176 | 176 | } |
| 177 | 177 | |
@@ -181,17 +181,17 @@ discard block |
||
| 181 | 181 | $vendor_config = require $path; |
| 182 | 182 | $config = $this->array_merge_recursive_distinct($vendor_config, $config); |
| 183 | 183 | |
| 184 | - if(is_array($config)){ |
|
| 185 | - if(isset($config['default'])){ |
|
| 186 | - if(isset($config['accounts']) && $config['default'] != false){ |
|
| 184 | + if (is_array($config)) { |
|
| 185 | + if (isset($config['default'])) { |
|
| 186 | + if (isset($config['accounts']) && $config['default'] != false) { |
|
| 187 | 187 | |
| 188 | 188 | $default_config = $vendor_config['accounts']['default']; |
| 189 | - if(isset($config['accounts'][$config['default']])){ |
|
| 189 | + if (isset($config['accounts'][$config['default']])) { |
|
| 190 | 190 | $default_config = array_merge($default_config, $config['accounts'][$config['default']]); |
| 191 | 191 | } |
| 192 | 192 | |
| 193 | - if(is_array($config['accounts'])){ |
|
| 194 | - foreach($config['accounts'] as $account_key => $account){ |
|
| 193 | + if (is_array($config['accounts'])) { |
|
| 194 | + foreach ($config['accounts'] as $account_key => $account) { |
|
| 195 | 195 | $config['accounts'][$account_key] = array_merge($default_config, $account); |
| 196 | 196 | } |
| 197 | 197 | } |
@@ -227,24 +227,24 @@ discard block |
||
| 227 | 227 | $arrays = func_get_args(); |
| 228 | 228 | $base = array_shift($arrays); |
| 229 | 229 | |
| 230 | - if(!is_array($base)) $base = empty($base) ? array() : array($base); |
|
| 230 | + if (!is_array($base)) $base = empty($base) ? array() : array($base); |
|
| 231 | 231 | |
| 232 | - foreach($arrays as $append) { |
|
| 232 | + foreach ($arrays as $append) { |
|
| 233 | 233 | |
| 234 | - if(!is_array($append)) $append = array($append); |
|
| 234 | + if (!is_array($append)) $append = array($append); |
|
| 235 | 235 | |
| 236 | - foreach($append as $key => $value) { |
|
| 236 | + foreach ($append as $key => $value) { |
|
| 237 | 237 | |
| 238 | - if(!array_key_exists($key, $base) and !is_numeric($key)) { |
|
| 238 | + if (!array_key_exists($key, $base) and !is_numeric($key)) { |
|
| 239 | 239 | $base[$key] = $append[$key]; |
| 240 | 240 | continue; |
| 241 | 241 | } |
| 242 | 242 | |
| 243 | - if(is_array($value) or is_array($base[$key])) { |
|
| 243 | + if (is_array($value) or is_array($base[$key])) { |
|
| 244 | 244 | $base[$key] = $this->array_merge_recursive_distinct($base[$key], $append[$key]); |
| 245 | - } else if(is_numeric($key)) { |
|
| 246 | - if(!in_array($value, $base)) $base[] = $value; |
|
| 247 | - } else { |
|
| 245 | + }else if (is_numeric($key)) { |
|
| 246 | + if (!in_array($value, $base)) $base[] = $value; |
|
| 247 | + }else { |
|
| 248 | 248 | $base[$key] = $value; |
| 249 | 249 | } |
| 250 | 250 | |