@@ -254,8 +254,8 @@ discard block |
||
| 254 | 254 | return false; |
| 255 | 255 | } |
| 256 | 256 | |
| 257 | - $test = 'catch-all-test-' . time(); |
|
| 258 | - $accepted = $this->rcpt($test . '@' . $domain); |
|
| 257 | + $test = 'catch-all-test-'.time(); |
|
| 258 | + $accepted = $this->rcpt($test.'@'.$domain); |
|
| 259 | 259 | if ($accepted) { |
| 260 | 260 | // Success on a non-existing address is a "catch-all" |
| 261 | 261 | $this->domains_info[$domain]['catchall'] = true; |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | // Log when we get disconnected while trying catchall detection |
| 266 | 266 | $this->noop(); |
| 267 | 267 | if (!$this->connected()) { |
| 268 | - $this->debug('Disconnected after trying a non-existing recipient on ' . $domain); |
|
| 268 | + $this->debug('Disconnected after trying a non-existing recipient on '.$domain); |
|
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | /** |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | foreach ($this->domains as $domain => $users) { |
| 324 | 324 | $mxs = $this->buildMxs($domain); |
| 325 | 325 | |
| 326 | - $this->debug('MX records (' . $domain . '): ' . print_r($mxs, true)); |
|
| 326 | + $this->debug('MX records ('.$domain.'): '.print_r($mxs, true)); |
|
| 327 | 327 | $this->domains_info[$domain] = []; |
| 328 | 328 | $this->domains_info[$domain]['users'] = $users; |
| 329 | 329 | $this->domains_info[$domain]['mxs'] = $mxs; |
@@ -374,7 +374,7 @@ discard block |
||
| 374 | 374 | } |
| 375 | 375 | } catch (NoConnectionException $e) { |
| 376 | 376 | // Unable to connect to host, so these addresses are invalid? |
| 377 | - $this->debug('Unable to connect. Exception caught: ' . $e->getMessage()); |
|
| 377 | + $this->debug('Unable to connect. Exception caught: '.$e->getMessage()); |
|
| 378 | 378 | } |
| 379 | 379 | } |
| 380 | 380 | } |
@@ -427,7 +427,7 @@ discard block |
||
| 427 | 427 | } |
| 428 | 428 | |
| 429 | 429 | // Try issuing MAIL FROM |
| 430 | - if (!$this->mail($this->from_user . '@' . $this->from_domain)) { |
|
| 430 | + if (!$this->mail($this->from_user.'@'.$this->from_domain)) { |
|
| 431 | 431 | // MAIL FROM not accepted, we can't talk |
| 432 | 432 | $this->setDomainResults($users, $domain, $this->no_comm_is_valid); |
| 433 | 433 | return; |
@@ -459,7 +459,7 @@ discard block |
||
| 459 | 459 | |
| 460 | 460 | // RCPT for each user |
| 461 | 461 | foreach ($users as $user) { |
| 462 | - $address = $user . '@' . $domain; |
|
| 462 | + $address = $user.'@'.$domain; |
|
| 463 | 463 | $this->results[$address] = $this->rcpt($address); |
| 464 | 464 | } |
| 465 | 465 | |
@@ -498,7 +498,7 @@ discard block |
||
| 498 | 498 | private function setDomainResults(array $users, $domain, $val) |
| 499 | 499 | { |
| 500 | 500 | foreach ($users as $user) { |
| 501 | - $this->results[$user . '@' . $domain] = $val; |
|
| 501 | + $this->results[$user.'@'.$domain] = $val; |
|
| 502 | 502 | } |
| 503 | 503 | } |
| 504 | 504 | |
@@ -524,13 +524,13 @@ discard block |
||
| 524 | 524 | */ |
| 525 | 525 | protected function connect($host) |
| 526 | 526 | { |
| 527 | - $remote_socket = $host . ':' . $this->connect_port; |
|
| 527 | + $remote_socket = $host.':'.$this->connect_port; |
|
| 528 | 528 | $errnum = 0; |
| 529 | 529 | $errstr = ''; |
| 530 | 530 | $this->host = $remote_socket; |
| 531 | 531 | |
| 532 | 532 | // Open connection |
| 533 | - $this->debug('Connecting to ' . $this->host); |
|
| 533 | + $this->debug('Connecting to '.$this->host); |
|
| 534 | 534 | // @codingStandardsIgnoreLine |
| 535 | 535 | $this->socket = /** @scrutinizer ignore-unhandled */ @stream_socket_client( |
| 536 | 536 | $this->host, |
@@ -543,8 +543,8 @@ discard block |
||
| 543 | 543 | |
| 544 | 544 | // Check and throw if not connected |
| 545 | 545 | if (!$this->connected()) { |
| 546 | - $this->debug('Connect failed: ' . $errstr . ', error number: ' . $errnum . ', host: ' . $this->host); |
|
| 547 | - throw new NoConnectionException('Cannot open a connection to remote host (' . $this->host . ')'); |
|
| 546 | + $this->debug('Connect failed: '.$errstr.', error number: '.$errnum.', host: '.$this->host); |
|
| 547 | + throw new NoConnectionException('Cannot open a connection to remote host ('.$this->host.')'); |
|
| 548 | 548 | } |
| 549 | 549 | |
| 550 | 550 | $result = stream_set_timeout($this->socket, $this->connect_timeout); |
@@ -552,7 +552,7 @@ discard block |
||
| 552 | 552 | throw new NoTimeoutException('Cannot set timeout'); |
| 553 | 553 | } |
| 554 | 554 | |
| 555 | - $this->debug('Connected to ' . $this->host . ' successfully'); |
|
| 555 | + $this->debug('Connected to '.$this->host.' successfully'); |
|
| 556 | 556 | } |
| 557 | 557 | |
| 558 | 558 | /** |
@@ -572,7 +572,7 @@ discard block |
||
| 572 | 572 | } |
| 573 | 573 | |
| 574 | 574 | if ($this->connected()) { |
| 575 | - $this->debug('Closing socket to ' . $this->host); |
|
| 575 | + $this->debug('Closing socket to '.$this->host); |
|
| 576 | 576 | fclose($this->socket); |
| 577 | 577 | } |
| 578 | 578 | |
@@ -632,7 +632,7 @@ discard block |
||
| 632 | 632 | } catch (UnexpectedResponseException $e) { |
| 633 | 633 | // Connected, but got an unexpected response, so disconnect |
| 634 | 634 | $result = false; |
| 635 | - $this->debug('Unexpected response after connecting: ' . $e->getMessage()); |
|
| 635 | + $this->debug('Unexpected response after connecting: '.$e->getMessage()); |
|
| 636 | 636 | $this->disconnect(false); |
| 637 | 637 | } |
| 638 | 638 | |
@@ -651,11 +651,11 @@ discard block |
||
| 651 | 651 | { |
| 652 | 652 | try { |
| 653 | 653 | // Modern |
| 654 | - $this->send('EHLO ' . $this->from_domain); |
|
| 654 | + $this->send('EHLO '.$this->from_domain); |
|
| 655 | 655 | $this->expect(self::SMTP_GENERIC_SUCCESS, $this->command_timeouts['ehlo']); |
| 656 | 656 | } catch (UnexpectedResponseException $e) { |
| 657 | 657 | // Legacy |
| 658 | - $this->send('HELO ' . $this->from_domain); |
|
| 658 | + $this->send('HELO '.$this->from_domain); |
|
| 659 | 659 | $this->expect(self::SMTP_GENERIC_SUCCESS, $this->command_timeouts['helo']); |
| 660 | 660 | } |
| 661 | 661 | } |
@@ -680,7 +680,7 @@ discard block |
||
| 680 | 680 | } |
| 681 | 681 | |
| 682 | 682 | // Issue MAIL FROM, 5 minute timeout |
| 683 | - $this->send('MAIL FROM:<' . $from . '>'); |
|
| 683 | + $this->send('MAIL FROM:<'.$from.'>'); |
|
| 684 | 684 | |
| 685 | 685 | try { |
| 686 | 686 | $this->expect(self::SMTP_GENERIC_SUCCESS, $this->command_timeouts['mail']); |
@@ -694,7 +694,7 @@ discard block |
||
| 694 | 694 | $result = false; |
| 695 | 695 | |
| 696 | 696 | // Got something unexpected in response to MAIL FROM |
| 697 | - $this->debug("Unexpected response to MAIL FROM\n:" . $e->getMessage()); |
|
| 697 | + $this->debug("Unexpected response to MAIL FROM\n:".$e->getMessage()); |
|
| 698 | 698 | |
| 699 | 699 | // Hotmail has been known to do this + was closing the connection |
| 700 | 700 | // forcibly on their end, so we're killing the socket here too |
@@ -733,17 +733,17 @@ discard block |
||
| 733 | 733 | |
| 734 | 734 | // Issue RCPT TO, 5 minute timeout |
| 735 | 735 | try { |
| 736 | - $this->send('RCPT TO:<' . $to . '>'); |
|
| 736 | + $this->send('RCPT TO:<'.$to.'>'); |
|
| 737 | 737 | // Handle response |
| 738 | 738 | try { |
| 739 | 739 | $this->expect($expected_codes, $this->command_timeouts['rcpt']); |
| 740 | 740 | $this->state['rcpt'] = true; |
| 741 | 741 | $valid = true; |
| 742 | 742 | } catch (UnexpectedResponseException $e) { |
| 743 | - $this->debug('Unexpected response to RCPT TO: ' . $e->getMessage()); |
|
| 743 | + $this->debug('Unexpected response to RCPT TO: '.$e->getMessage()); |
|
| 744 | 744 | } |
| 745 | 745 | } catch (Exception $e) { |
| 746 | - $this->debug('Sending RCPT TO failed: ' . $e->getMessage()); |
|
| 746 | + $this->debug('Sending RCPT TO failed: '.$e->getMessage()); |
|
| 747 | 747 | } |
| 748 | 748 | |
| 749 | 749 | return $valid; |
@@ -788,7 +788,7 @@ discard block |
||
| 788 | 788 | if ($this->state['helo']) { |
| 789 | 789 | $this->send('QUIT'); |
| 790 | 790 | $this->expect( |
| 791 | - [self::SMTP_GENERIC_SUCCESS,self::SMTP_QUIT_SUCCESS], |
|
| 791 | + [self::SMTP_GENERIC_SUCCESS, self::SMTP_QUIT_SUCCESS], |
|
| 792 | 792 | $this->command_timeouts['quit'], |
| 793 | 793 | true |
| 794 | 794 | ); |
@@ -842,13 +842,13 @@ discard block |
||
| 842 | 842 | // Must be connected |
| 843 | 843 | $this->throwIfNotConnected(); |
| 844 | 844 | |
| 845 | - $this->debug('send>>>: ' . $cmd); |
|
| 845 | + $this->debug('send>>>: '.$cmd); |
|
| 846 | 846 | // Write the cmd to the connection stream |
| 847 | - $result = fwrite($this->socket, $cmd . self::CRLF); |
|
| 847 | + $result = fwrite($this->socket, $cmd.self::CRLF); |
|
| 848 | 848 | |
| 849 | 849 | // Did it work? |
| 850 | 850 | if (false === $result) { |
| 851 | - throw new SendFailedException('Send failed on: ' . $this->host); |
|
| 851 | + throw new SendFailedException('Send failed on: '.$this->host); |
|
| 852 | 852 | } |
| 853 | 853 | |
| 854 | 854 | return $result; |
@@ -877,7 +877,7 @@ discard block |
||
| 877 | 877 | |
| 878 | 878 | // Retrieve response |
| 879 | 879 | $line = fgets($this->socket, 1024); |
| 880 | - $this->debug('<<<recv: ' . $line); |
|
| 880 | + $this->debug('<<<recv: '.$line); |
|
| 881 | 881 | |
| 882 | 882 | // Have we timed out? |
| 883 | 883 | $info = stream_get_meta_data($this->socket); |
@@ -932,7 +932,7 @@ discard block |
||
| 932 | 932 | * No response in expect() probably means that the remote server |
| 933 | 933 | * forcibly closed the connection so lets clean up on our end as well? |
| 934 | 934 | */ |
| 935 | - $this->debug('No response in expect(): ' . $e->getMessage()); |
|
| 935 | + $this->debug('No response in expect(): '.$e->getMessage()); |
|
| 936 | 936 | $this->disconnect(false); |
| 937 | 937 | } |
| 938 | 938 | |
@@ -1030,9 +1030,9 @@ discard block |
||
| 1030 | 1030 | $this->log($str); |
| 1031 | 1031 | if ($this->debug) { |
| 1032 | 1032 | if ('cli' !== PHP_SAPI) { |
| 1033 | - $str = '<br/><pre>' . htmlspecialchars($str) . '</pre>'; |
|
| 1033 | + $str = '<br/><pre>'.htmlspecialchars($str).'</pre>'; |
|
| 1034 | 1034 | } |
| 1035 | - echo "\n" . $str; |
|
| 1035 | + echo "\n".$str; |
|
| 1036 | 1036 | } |
| 1037 | 1037 | } |
| 1038 | 1038 | |
@@ -1056,7 +1056,7 @@ discard block |
||
| 1056 | 1056 | private function stamp($msg) |
| 1057 | 1057 | { |
| 1058 | 1058 | $date = \DateTime::createFromFormat('U.u', sprintf('%.f', microtime(true)))->format('Y-m-d\TH:i:s.uO'); |
| 1059 | - $line = '[' . $date . '] ' . $msg; |
|
| 1059 | + $line = '['.$date.'] '.$msg; |
|
| 1060 | 1060 | |
| 1061 | 1061 | return $line; |
| 1062 | 1062 | } |
@@ -1093,7 +1093,7 @@ discard block |
||
| 1093 | 1093 | if (\method_exists($this, $camelized)) { |
| 1094 | 1094 | return \call_user_func_array([$this, $camelized], $args); |
| 1095 | 1095 | } else { |
| 1096 | - trigger_error('Fatal error: Call to undefined method ' . self::class . '::' . $name . '()', E_USER_ERROR); |
|
| 1096 | + trigger_error('Fatal error: Call to undefined method '.self::class.'::'.$name.'()', E_USER_ERROR); |
|
| 1097 | 1097 | } |
| 1098 | 1098 | } |
| 1099 | 1099 | |