@@ -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; |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | { |
344 | 344 | $mxs = []; |
345 | 345 | |
346 | - $this->debug('Building MX records for domain: ' . $domain); |
|
346 | + $this->debug('Building MX records for domain: '.$domain); |
|
347 | 347 | |
348 | 348 | // Query the MX records for the current domain |
349 | 349 | [$hosts, $weights] = $this->mxQuery($domain); |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | } |
377 | 377 | } catch (NoConnectionException $e) { |
378 | 378 | // Unable to connect to host, so these addresses are invalid? |
379 | - $this->debug('Unable to connect. Exception caught: ' . $e->getMessage()); |
|
379 | + $this->debug('Unable to connect. Exception caught: '.$e->getMessage()); |
|
380 | 380 | } |
381 | 381 | } |
382 | 382 | } |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | } |
430 | 430 | |
431 | 431 | // Try issuing MAIL FROM |
432 | - if (!$this->mail($this->from_user . '@' . $this->from_domain)) { |
|
432 | + if (!$this->mail($this->from_user.'@'.$this->from_domain)) { |
|
433 | 433 | // MAIL FROM not accepted, we can't talk |
434 | 434 | $this->setDomainResults($users, $domain, $this->no_comm_is_valid); |
435 | 435 | return; |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | |
459 | 459 | // RCPT for each user |
460 | 460 | foreach ($users as $user) { |
461 | - $address = $user . '@' . $domain; |
|
461 | + $address = $user.'@'.$domain; |
|
462 | 462 | $this->results[$address] = $this->rcpt($address); |
463 | 463 | } |
464 | 464 | |
@@ -497,7 +497,7 @@ discard block |
||
497 | 497 | private function setDomainResults(array $users, string $domain, bool $val): void |
498 | 498 | { |
499 | 499 | foreach ($users as $user) { |
500 | - $this->results[$user . '@' . $domain] = $val; |
|
500 | + $this->results[$user.'@'.$domain] = $val; |
|
501 | 501 | } |
502 | 502 | } |
503 | 503 | |
@@ -523,13 +523,13 @@ discard block |
||
523 | 523 | */ |
524 | 524 | protected function connect(string $host): void |
525 | 525 | { |
526 | - $remote_socket = $host . ':' . $this->connect_port; |
|
526 | + $remote_socket = $host.':'.$this->connect_port; |
|
527 | 527 | $errnum = 0; |
528 | 528 | $errstr = ''; |
529 | 529 | $this->host = $remote_socket; |
530 | 530 | |
531 | 531 | // Open connection |
532 | - $this->debug('Connecting to ' . $this->host . ' (timeout: ' . $this->connect_timeout . ')'); |
|
532 | + $this->debug('Connecting to '.$this->host.' (timeout: '.$this->connect_timeout.')'); |
|
533 | 533 | // @codingStandardsIgnoreLine |
534 | 534 | $this->socket = /** @scrutinizer ignore-unhandled */ @stream_socket_client( |
535 | 535 | $this->host, |
@@ -542,8 +542,8 @@ discard block |
||
542 | 542 | |
543 | 543 | // Check and throw if not connected |
544 | 544 | if (!$this->connected()) { |
545 | - $this->debug('Connect failed: ' . $errstr . ', error number: ' . $errnum . ', host: ' . $this->host); |
|
546 | - throw new NoConnectionException('Cannot open a connection to remote host (' . $this->host . ')'); |
|
545 | + $this->debug('Connect failed: '.$errstr.', error number: '.$errnum.', host: '.$this->host); |
|
546 | + throw new NoConnectionException('Cannot open a connection to remote host ('.$this->host.')'); |
|
547 | 547 | } |
548 | 548 | |
549 | 549 | $result = stream_set_timeout($this->socket, $this->connect_timeout); |
@@ -551,7 +551,7 @@ discard block |
||
551 | 551 | throw new NoTimeoutException('Cannot set timeout'); |
552 | 552 | } |
553 | 553 | |
554 | - $this->debug('Connected to ' . $this->host . ' successfully'); |
|
554 | + $this->debug('Connected to '.$this->host.' successfully'); |
|
555 | 555 | } |
556 | 556 | |
557 | 557 | /** |
@@ -571,7 +571,7 @@ discard block |
||
571 | 571 | } |
572 | 572 | |
573 | 573 | if ($this->connected()) { |
574 | - $this->debug('Closing socket to ' . $this->host); |
|
574 | + $this->debug('Closing socket to '.$this->host); |
|
575 | 575 | fclose($this->socket); |
576 | 576 | } |
577 | 577 | |
@@ -631,7 +631,7 @@ discard block |
||
631 | 631 | } catch (UnexpectedResponseException $e) { |
632 | 632 | // Connected, but got an unexpected response, so disconnect |
633 | 633 | $result = false; |
634 | - $this->debug('Unexpected response after connecting: ' . $e->getMessage()); |
|
634 | + $this->debug('Unexpected response after connecting: '.$e->getMessage()); |
|
635 | 635 | $this->disconnect(false); |
636 | 636 | } |
637 | 637 | |
@@ -650,11 +650,11 @@ discard block |
||
650 | 650 | { |
651 | 651 | try { |
652 | 652 | // Modern |
653 | - $this->send('EHLO ' . $this->from_domain); |
|
653 | + $this->send('EHLO '.$this->from_domain); |
|
654 | 654 | $this->expect(self::SMTP_GENERIC_SUCCESS, $this->command_timeouts['ehlo']); |
655 | 655 | } catch (UnexpectedResponseException $e) { |
656 | 656 | // Legacy |
657 | - $this->send('HELO ' . $this->from_domain); |
|
657 | + $this->send('HELO '.$this->from_domain); |
|
658 | 658 | $this->expect(self::SMTP_GENERIC_SUCCESS, $this->command_timeouts['helo']); |
659 | 659 | } |
660 | 660 | } |
@@ -679,7 +679,7 @@ discard block |
||
679 | 679 | } |
680 | 680 | |
681 | 681 | // Issue MAIL FROM, 5 minute timeout |
682 | - $this->send('MAIL FROM:<' . $from . '>'); |
|
682 | + $this->send('MAIL FROM:<'.$from.'>'); |
|
683 | 683 | |
684 | 684 | try { |
685 | 685 | $this->expect(self::SMTP_GENERIC_SUCCESS, $this->command_timeouts['mail']); |
@@ -693,7 +693,7 @@ discard block |
||
693 | 693 | $result = false; |
694 | 694 | |
695 | 695 | // Got something unexpected in response to MAIL FROM |
696 | - $this->debug("Unexpected response to MAIL FROM\n:" . $e->getMessage()); |
|
696 | + $this->debug("Unexpected response to MAIL FROM\n:".$e->getMessage()); |
|
697 | 697 | |
698 | 698 | // Hotmail has been known to do this + was closing the connection |
699 | 699 | // forcibly on their end, so we're killing the socket here too |
@@ -732,17 +732,17 @@ discard block |
||
732 | 732 | |
733 | 733 | // Issue RCPT TO, 5 minute timeout |
734 | 734 | try { |
735 | - $this->send('RCPT TO:<' . $to . '>'); |
|
735 | + $this->send('RCPT TO:<'.$to.'>'); |
|
736 | 736 | // Handle response |
737 | 737 | try { |
738 | 738 | $this->expect($expected_codes, $this->command_timeouts['rcpt']); |
739 | 739 | $this->state['rcpt'] = true; |
740 | 740 | $valid = true; |
741 | 741 | } catch (UnexpectedResponseException $e) { |
742 | - $this->debug('Unexpected response to RCPT TO: ' . $e->getMessage()); |
|
742 | + $this->debug('Unexpected response to RCPT TO: '.$e->getMessage()); |
|
743 | 743 | } |
744 | 744 | } catch (Exception $e) { |
745 | - $this->debug('Sending RCPT TO failed: ' . $e->getMessage()); |
|
745 | + $this->debug('Sending RCPT TO failed: '.$e->getMessage()); |
|
746 | 746 | } |
747 | 747 | |
748 | 748 | return $valid; |
@@ -787,7 +787,7 @@ discard block |
||
787 | 787 | if ($this->state['helo']) { |
788 | 788 | $this->send('QUIT'); |
789 | 789 | $this->expect( |
790 | - [self::SMTP_GENERIC_SUCCESS,self::SMTP_QUIT_SUCCESS], |
|
790 | + [self::SMTP_GENERIC_SUCCESS, self::SMTP_QUIT_SUCCESS], |
|
791 | 791 | $this->command_timeouts['quit'], |
792 | 792 | true |
793 | 793 | ); |
@@ -841,13 +841,13 @@ discard block |
||
841 | 841 | // Must be connected |
842 | 842 | $this->throwIfNotConnected(); |
843 | 843 | |
844 | - $this->debug('send>>>: ' . $cmd); |
|
844 | + $this->debug('send>>>: '.$cmd); |
|
845 | 845 | // Write the cmd to the connection stream |
846 | - $result = fwrite($this->socket, $cmd . self::CRLF); |
|
846 | + $result = fwrite($this->socket, $cmd.self::CRLF); |
|
847 | 847 | |
848 | 848 | // Did it work? |
849 | 849 | if (false === $result) { |
850 | - throw new SendFailedException('Send failed on: ' . $this->host); |
|
850 | + throw new SendFailedException('Send failed on: '.$this->host); |
|
851 | 851 | } |
852 | 852 | |
853 | 853 | return $result; |
@@ -876,7 +876,7 @@ discard block |
||
876 | 876 | |
877 | 877 | // Retrieve response |
878 | 878 | $line = fgets($this->socket, 1024); |
879 | - $this->debug('<<<recv: ' . $line); |
|
879 | + $this->debug('<<<recv: '.$line); |
|
880 | 880 | |
881 | 881 | // Have we timed out? |
882 | 882 | $info = stream_get_meta_data($this->socket); |
@@ -931,7 +931,7 @@ discard block |
||
931 | 931 | * No response in expect() probably means that the remote server |
932 | 932 | * forcibly closed the connection so let's clean up on our end as well? |
933 | 933 | */ |
934 | - $this->debug('No response in expect(): ' . $e->getMessage()); |
|
934 | + $this->debug('No response in expect(): '.$e->getMessage()); |
|
935 | 935 | $this->disconnect(false); |
936 | 936 | } |
937 | 937 | |
@@ -1037,9 +1037,9 @@ discard block |
||
1037 | 1037 | |
1038 | 1038 | if ($this->debug) { |
1039 | 1039 | if ('cli' !== PHP_SAPI) { |
1040 | - $str = '<br/><pre>' . htmlspecialchars($str) . '</pre>'; |
|
1040 | + $str = '<br/><pre>'.htmlspecialchars($str).'</pre>'; |
|
1041 | 1041 | } |
1042 | - echo "\n" . $str; |
|
1042 | + echo "\n".$str; |
|
1043 | 1043 | } |
1044 | 1044 | } |
1045 | 1045 | |
@@ -1062,7 +1062,7 @@ discard block |
||
1062 | 1062 | */ |
1063 | 1063 | private function stamp(string $msg): string |
1064 | 1064 | { |
1065 | - return '[' . $this->getLogDate() . '] ' . $msg; |
|
1065 | + return '['.$this->getLogDate().'] '.$msg; |
|
1066 | 1066 | } |
1067 | 1067 | |
1068 | 1068 | /** |
@@ -1119,7 +1119,7 @@ discard block |
||
1119 | 1119 | return \call_user_func_array([$this, $camelized], $args); |
1120 | 1120 | } |
1121 | 1121 | |
1122 | - trigger_error('Fatal error: Call to undefined method ' . self::class . '::' . $name . '()', E_USER_ERROR); |
|
1122 | + trigger_error('Fatal error: Call to undefined method '.self::class.'::'.$name.'()', E_USER_ERROR); |
|
1123 | 1123 | } |
1124 | 1124 | |
1125 | 1125 | /** |
@@ -1270,16 +1270,16 @@ discard block |
||
1270 | 1270 | if (($bindAddress[0] !== '[') && filter_var($bindAddress, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) { |
1271 | 1271 | // If given string does not start with [, but is valid ipv6, wrap it in [] and |
1272 | 1272 | // assume port is 0 |
1273 | - $ip = '[' . $bindAddress . ']'; |
|
1273 | + $ip = '['.$bindAddress.']'; |
|
1274 | 1274 | $port = '0'; |
1275 | 1275 | } else { |
1276 | 1276 | // If address starts with [ or does not appear to be ipv6, let parse_url() handle it |
1277 | - $parts = @parse_url('https://' . $bindAddress); |
|
1277 | + $parts = @parse_url('https://'.$bindAddress); |
|
1278 | 1278 | $ip = $parts['host'] ?? $bindAddress; |
1279 | 1279 | $port = $parts['port'] ?? '0'; |
1280 | 1280 | } |
1281 | 1281 | |
1282 | - return $ip . ':' . $port; |
|
1282 | + return $ip.':'.$port; |
|
1283 | 1283 | } |
1284 | 1284 | |
1285 | 1285 | /** |