| @@ -311,16 +311,16 @@ discard block | ||
| 311 | 311 | public function globalDelete(): bool | 
| 312 | 312 |      { | 
| 313 | 313 |          $dateArr = \explode('-', $this->deleteMsgDate); // date format is yyyy-mm-dd | 
| 314 | - $delDate = \mktime(0, 0, 0, (int) ($dateArr[1]), (int) ($dateArr[2]), (int) ($dateArr[0])); | |
| 314 | + $delDate = \mktime(0, 0, 0, (int)($dateArr[1]), (int)($dateArr[2]), (int)($dateArr[0])); | |
| 315 | 315 | |
| 316 | - $port = $this->port . '/' . $this->service . '/' . $this->serviceOption; | |
| 317 | -        $mboxt = \imap_open('{' . $this->mailhost . ':' . $port . '}', $this->mailboxUserName, $this->mailboxPassword, OP_HALFOPEN); | |
| 316 | + $port = $this->port.'/'.$this->service.'/'.$this->serviceOption; | |
| 317 | +        $mboxt = \imap_open('{'.$this->mailhost.':'.$port.'}', $this->mailboxUserName, $this->mailboxPassword, OP_HALFOPEN); | |
| 318 | 318 | |
| 319 | 319 |          if ($mboxt === false) { | 
| 320 | 320 | return false; | 
| 321 | 321 | } | 
| 322 | 322 | |
| 323 | -        $list = \imap_getmailboxes($mboxt, '{' . $this->mailhost . ':' . $port . '}', '*'); | |
| 323 | +        $list = \imap_getmailboxes($mboxt, '{'.$this->mailhost.':'.$port.'}', '*'); | |
| 324 | 324 | |
| 325 | 325 |          if (\is_array($list)) { | 
| 326 | 326 |              foreach ($list as $key => $val) { | 
| @@ -329,7 +329,7 @@ discard block | ||
| 329 | 329 | $nameRaw = $nameArr[\count($nameArr) - 1]; | 
| 330 | 330 | |
| 331 | 331 |                  if (\stripos($nameRaw, 'sent') === false) { | 
| 332 | -                    $mboxd = \imap_open('{' . $this->mailhost . ':' . $port . '}' . $nameRaw, $this->mailboxUserName, $this->mailboxPassword, CL_EXPUNGE); | |
| 332 | +                    $mboxd = \imap_open('{'.$this->mailhost.':'.$port.'}'.$nameRaw, $this->mailboxUserName, $this->mailboxPassword, CL_EXPUNGE); | |
| 333 | 333 | $messages = \imap_sort($mboxd, SORTDATE, 0); | 
| 334 | 334 | |
| 335 | 335 |                      foreach ($messages as $message) { | 
| @@ -399,19 +399,19 @@ discard block | ||
| 399 | 399 |          if (\trim($mailbox) === '') { | 
| 400 | 400 | // this is a critical error with either the mailbox name blank or an invalid mailbox name | 
| 401 | 401 | // need to stop processing and exit at this point | 
| 402 | - echo 'Invalid mailbox name for move operation. Cannot continue: ' . $mailbox . "<br />\n"; | |
| 402 | + echo 'Invalid mailbox name for move operation. Cannot continue: '.$mailbox."<br />\n"; | |
| 403 | 403 | exit(); | 
| 404 | 404 | } | 
| 405 | 405 | |
| 406 | - $port = $this->port . '/' . $this->service . '/' . $this->serviceOption; | |
| 406 | + $port = $this->port.'/'.$this->service.'/'.$this->serviceOption; | |
| 407 | 407 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ | 
| 408 | -        $mbox = @\imap_open('{' . $this->mailhost . ':' . $port . '}', $this->mailboxUserName, $this->mailboxPassword, OP_HALFOPEN); | |
| 408 | +        $mbox = @\imap_open('{'.$this->mailhost.':'.$port.'}', $this->mailboxUserName, $this->mailboxPassword, OP_HALFOPEN); | |
| 409 | 409 | |
| 410 | 410 |          if ($mbox === false) { | 
| 411 | 411 | return false; | 
| 412 | 412 | } | 
| 413 | 413 | |
| 414 | -        $list = \imap_getmailboxes($mbox, '{' . $this->mailhost . ':' . $port . '}', '*'); | |
| 414 | +        $list = \imap_getmailboxes($mbox, '{'.$this->mailhost.':'.$port.'}', '*'); | |
| 415 | 415 | $mailboxFound = false; | 
| 416 | 416 | |
| 417 | 417 |          if (\is_array($list)) { | 
| @@ -426,7 +426,7 @@ discard block | ||
| 426 | 426 | |
| 427 | 427 |              if ($mailboxFound === false && $create) { | 
| 428 | 428 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ | 
| 429 | -                @\imap_createmailbox($mbox, \imap_utf7_encode('{' . $this->mailhost . ':' . $port . '}' . $mailbox)); | |
| 429 | +                @\imap_createmailbox($mbox, \imap_utf7_encode('{'.$this->mailhost.':'.$port.'}'.$mailbox)); | |
| 430 | 430 | \imap_errors(); | 
| 431 | 431 | \imap_alerts(); | 
| 432 | 432 | \imap_close($mbox); | 
| @@ -466,13 +466,13 @@ discard block | ||
| 466 | 466 | } | 
| 467 | 467 | |
| 468 | 468 |          if (!$this->mailboxLink) { | 
| 469 | - $this->errorMessage = 'Cannot open the mailbox file to ' . $filePath . $this->bmhNewLine . 'Error MSG: ' . \imap_last_error(); | |
| 469 | + $this->errorMessage = 'Cannot open the mailbox file to '.$filePath.$this->bmhNewLine.'Error MSG: '.\imap_last_error(); | |
| 470 | 470 | $this->output(); | 
| 471 | 471 | |
| 472 | 472 | return false; | 
| 473 | 473 | } | 
| 474 | 474 | |
| 475 | -        $this->output('Opened ' . $filePath); | |
| 475 | +        $this->output('Opened '.$filePath); | |
| 476 | 476 | |
| 477 | 477 | return true; | 
| 478 | 478 | } | 
| @@ -486,7 +486,7 @@ discard block | ||
| 486 | 486 |      { | 
| 487 | 487 | // before starting the processing, let's check the delete flag and do global deletes if true | 
| 488 | 488 |          if (\trim($this->deleteMsgDate) !== '') { | 
| 489 | - echo 'processing global delete based on date of ' . $this->deleteMsgDate . '<br />'; | |
| 489 | + echo 'processing global delete based on date of '.$this->deleteMsgDate.'<br />'; | |
| 490 | 490 | $this->globalDelete(); | 
| 491 | 491 | } | 
| 492 | 492 | |
| @@ -496,24 +496,24 @@ discard block | ||
| 496 | 496 | $this->moveHard = false; | 
| 497 | 497 | } | 
| 498 | 498 | |
| 499 | - $port = $this->port . '/' . $this->service . '/' . $this->serviceOption; | |
| 499 | + $port = $this->port.'/'.$this->service.'/'.$this->serviceOption; | |
| 500 | 500 | |
| 501 | 501 | \set_time_limit(self::SECONDS_TIMEOUT); | 
| 502 | 502 | |
| 503 | 503 |          if (!$this->testMode) { | 
| 504 | -            $this->mailboxLink = \imap_open('{' . $this->mailhost . ':' . $port . '}' . $this->boxname, $this->mailboxUserName, $this->mailboxPassword, CL_EXPUNGE | ($this->testMode ? OP_READONLY : 0)); | |
| 504 | +            $this->mailboxLink = \imap_open('{'.$this->mailhost.':'.$port.'}'.$this->boxname, $this->mailboxUserName, $this->mailboxPassword, CL_EXPUNGE | ($this->testMode ? OP_READONLY : 0)); | |
| 505 | 505 |          } else { | 
| 506 | -            $this->mailboxLink = \imap_open('{' . $this->mailhost . ':' . $port . '}' . $this->boxname, $this->mailboxUserName, $this->mailboxPassword, ($this->testMode ? OP_READONLY : 0)); | |
| 506 | +            $this->mailboxLink = \imap_open('{'.$this->mailhost.':'.$port.'}'.$this->boxname, $this->mailboxUserName, $this->mailboxPassword, ($this->testMode ? OP_READONLY : 0)); | |
| 507 | 507 | } | 
| 508 | 508 | |
| 509 | 509 |          if (!$this->mailboxLink) { | 
| 510 | - $this->errorMessage = 'Cannot create ' . $this->service . ' connection to ' . $this->mailhost . $this->bmhNewLine . 'Error MSG: ' . \imap_last_error(); | |
| 510 | + $this->errorMessage = 'Cannot create '.$this->service.' connection to '.$this->mailhost.$this->bmhNewLine.'Error MSG: '.\imap_last_error(); | |
| 511 | 511 | $this->output(); | 
| 512 | 512 | |
| 513 | 513 | return false; | 
| 514 | 514 | } | 
| 515 | 515 | |
| 516 | -        $this->output('Connected to: ' . $this->mailhost . ' (' . $this->mailboxUserName . ')'); | |
| 516 | +        $this->output('Connected to: '.$this->mailhost.' ('.$this->mailboxUserName.')'); | |
| 517 | 517 | |
| 518 | 518 | return true; | 
| 519 | 519 | } | 
| @@ -528,9 +528,9 @@ discard block | ||
| 528 | 528 |      { | 
| 529 | 529 |          if ($this->verbose >= $verboseLevel) { | 
| 530 | 530 |              if ($msg) { | 
| 531 | - echo $msg . $this->bmhNewLine; | |
| 531 | + echo $msg.$this->bmhNewLine; | |
| 532 | 532 |              } else { | 
| 533 | - echo $this->errorMessage . $this->bmhNewLine; | |
| 533 | + echo $this->errorMessage.$this->bmhNewLine; | |
| 534 | 534 | } | 
| 535 | 535 | } | 
| 536 | 536 | } | 
| @@ -616,7 +616,7 @@ discard block | ||
| 616 | 616 | break; | 
| 617 | 617 | |
| 618 | 618 | default: // un-support Content-type | 
| 619 | -                    $this->output('Msg #' . $pos . ' is unsupported Content-Type:' . $structure->type, self::VERBOSE_REPORT); | |
| 619 | +                    $this->output('Msg #'.$pos.' is unsupported Content-Type:'.$structure->type, self::VERBOSE_REPORT); | |
| 620 | 620 | |
| 621 | 621 | return false; | 
| 622 | 622 | } | 
| @@ -663,7 +663,7 @@ discard block | ||
| 663 | 663 | } | 
| 664 | 664 | |
| 665 | 665 |              if ($this->testMode) { | 
| 666 | -                $this->output('Match: ' . $ruleNumber . ':' . $ruleCategory . '; ' . $bounceType . '; ' . $email); | |
| 666 | +                $this->output('Match: '.$ruleNumber.':'.$ruleCategory.'; '.$bounceType.'; '.$email); | |
| 667 | 667 |              } else { | 
| 668 | 668 | // code below will use the Callback function, but return no value | 
| 669 | 669 | $params = [ | 
| @@ -688,7 +688,7 @@ discard block | ||
| 688 | 688 |          } else { | 
| 689 | 689 | // match rule, do bounce action | 
| 690 | 690 |              if ($this->testMode) { | 
| 691 | -                $this->output('Match: ' . $ruleNumber . ':' . $ruleCategory . '; ' . $bounceType . '; ' . $email); | |
| 691 | +                $this->output('Match: '.$ruleNumber.':'.$ruleCategory.'; '.$bounceType.'; '.$email); | |
| 692 | 692 | |
| 693 | 693 | return true; | 
| 694 | 694 | } | 
| @@ -754,12 +754,12 @@ discard block | ||
| 754 | 754 | $unprocessedCount = 0; | 
| 755 | 755 | $deletedCount = 0; | 
| 756 | 756 | $movedCount = 0; | 
| 757 | -        $this->output('Total: ' . $totalCount . ' messages '); | |
| 757 | +        $this->output('Total: '.$totalCount.' messages '); | |
| 758 | 758 | |
| 759 | 759 | // process maximum number of messages | 
| 760 | 760 |          if ($fetchedCount > $this->maxMessages) { | 
| 761 | 761 | $fetchedCount = $this->maxMessages; | 
| 762 | -            $this->output('Processing first ' . $fetchedCount . ' messages '); | |
| 762 | +            $this->output('Processing first '.$fetchedCount.' messages '); | |
| 763 | 763 | } | 
| 764 | 764 | |
| 765 | 765 |          if ($this->testMode) { | 
| @@ -801,7 +801,7 @@ discard block | ||
| 801 | 801 | $processedResult = $this->processBounce($x, 'DSN', $totalCount); | 
| 802 | 802 |                  } else { | 
| 803 | 803 | // not standard DSN msg | 
| 804 | -                    $this->output('Msg #' . $x . ' is not a standard DSN message', self::VERBOSE_REPORT); | |
| 804 | +                    $this->output('Msg #'.$x.' is not a standard DSN message', self::VERBOSE_REPORT); | |
| 805 | 805 | |
| 806 | 806 |                      if ($this->debugBodyRule) { | 
| 807 | 807 |                          if ($structure->ifdescription) { | 
| @@ -827,7 +827,7 @@ discard block | ||
| 827 | 827 | $processedResult = $this->processBounce($x, 'DSN', $totalCount); | 
| 828 | 828 |                      } else { | 
| 829 | 829 | // not standard DSN msg | 
| 830 | -                        $this->output('Msg #' . $x . ' is not a standard DSN message', self::VERBOSE_REPORT); | |
| 830 | +                        $this->output('Msg #'.$x.' is not a standard DSN message', self::VERBOSE_REPORT); | |
| 831 | 831 | |
| 832 | 832 |                          if ($this->debugBodyRule) { | 
| 833 | 833 |                              $this->output("  Content-Type : {$match[1]}", self::VERBOSE_DEBUG); | 
| @@ -837,10 +837,10 @@ discard block | ||
| 837 | 837 | } | 
| 838 | 838 |                  } else { | 
| 839 | 839 | // didn't get content-type header | 
| 840 | -                    $this->output('Msg #' . $x . ' is not a well-formatted MIME mail, missing Content-Type', self::VERBOSE_REPORT); | |
| 840 | +                    $this->output('Msg #'.$x.' is not a well-formatted MIME mail, missing Content-Type', self::VERBOSE_REPORT); | |
| 841 | 841 | |
| 842 | 842 |                      if ($this->debugBodyRule) { | 
| 843 | -                        $this->output('  Headers: ' . $this->bmhNewLine . $header . $this->bmhNewLine, self::VERBOSE_DEBUG); | |
| 843 | +                        $this->output('  Headers: '.$this->bmhNewLine.$header.$this->bmhNewLine, self::VERBOSE_DEBUG); | |
| 844 | 844 | } | 
| 845 | 845 | |
| 846 | 846 | $processedResult = $this->processBounce($x, 'BODY', $totalCount); | 
| @@ -871,7 +871,7 @@ discard block | ||
| 871 | 871 | // move the message | 
| 872 | 872 |                      if (!$this->testMode) { | 
| 873 | 873 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ | 
| 874 | - @\imap_mail_move($this->mailboxLink, (string) $x, $this->hardMailbox); | |
| 874 | + @\imap_mail_move($this->mailboxLink, (string)$x, $this->hardMailbox); | |
| 875 | 875 | } | 
| 876 | 876 | |
| 877 | 877 | $moveFlag[$x] = true; | 
| @@ -885,7 +885,7 @@ discard block | ||
| 885 | 885 | // move the message | 
| 886 | 886 |                      if (!$this->testMode) { | 
| 887 | 887 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ | 
| 888 | - @\imap_mail_move($this->mailboxLink, (string) $x, $this->softMailbox); | |
| 888 | + @\imap_mail_move($this->mailboxLink, (string)$x, $this->softMailbox); | |
| 889 | 889 | } | 
| 890 | 890 | |
| 891 | 891 | $moveFlag[$x] = true; | 
| @@ -909,25 +909,25 @@ discard block | ||
| 909 | 909 | $this->mailboxExist($this->unprocessedBox); | 
| 910 | 910 | // move the message | 
| 911 | 911 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ | 
| 912 | - @\imap_mail_move($this->mailboxLink, (string) $x, $this->unprocessedBox); | |
| 912 | + @\imap_mail_move($this->mailboxLink, (string)$x, $this->unprocessedBox); | |
| 913 | 913 | $moveFlag[$x] = true; | 
| 914 | 914 | } | 
| 915 | 915 | |
| 916 | 916 | \flush(); | 
| 917 | 917 | } | 
| 918 | 918 | |
| 919 | - $this->output($this->bmhNewLine . 'Closing mailbox, and purging messages'); | |
| 919 | + $this->output($this->bmhNewLine.'Closing mailbox, and purging messages'); | |
| 920 | 920 | |
| 921 | 921 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ | 
| 922 | 922 | @\imap_expunge($this->mailboxLink); | 
| 923 | 923 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ | 
| 924 | 924 | @\imap_close($this->mailboxLink); | 
| 925 | 925 | |
| 926 | -        $this->output('Read: ' . $fetchedCount . ' messages'); | |
| 927 | - $this->output($processedCount . ' action taken'); | |
| 928 | - $this->output($unprocessedCount . ' no action taken'); | |
| 929 | - $this->output($deletedCount . ' messages deleted'); | |
| 930 | - $this->output($movedCount . ' messages moved'); | |
| 926 | +        $this->output('Read: '.$fetchedCount.' messages'); | |
| 927 | + $this->output($processedCount.' action taken'); | |
| 928 | + $this->output($unprocessedCount.' no action taken'); | |
| 929 | + $this->output($deletedCount.' messages deleted'); | |
| 930 | + $this->output($movedCount.' messages moved'); | |
| 931 | 931 | |
| 932 | 932 | return true; | 
| 933 | 933 | } |