@@ -229,8 +229,8 @@ discard block |
||
| 229 | 229 | return false; |
| 230 | 230 | } |
| 231 | 231 | |
| 232 | - $test = 'catch-all-test-' . time(); |
|
| 233 | - $accepted = $this->rcpt($test . '@' . $domain); |
|
| 232 | + $test = 'catch-all-test-'.time(); |
|
| 233 | + $accepted = $this->rcpt($test.'@'.$domain); |
|
| 234 | 234 | if ($accepted) { |
| 235 | 235 | // Success on a non-existing address is a "catch-all" |
| 236 | 236 | $this->domains_info[$domain]['catchall'] = true; |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | // Log when we get disconnected while trying catchall detection |
| 241 | 241 | $this->noop(); |
| 242 | 242 | if (!$this->connected()) { |
| 243 | - $this->debug('Disconnected after trying a non-existing recipient on ' . $domain); |
|
| 243 | + $this->debug('Disconnected after trying a non-existing recipient on '.$domain); |
|
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | /** |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | foreach ($this->domains as $domain => $users) { |
| 288 | 288 | $mxs = $this->buildMxs($domain); |
| 289 | 289 | |
| 290 | - $this->debug('MX records (' . $domain . '): ' . print_r($mxs, true)); |
|
| 290 | + $this->debug('MX records ('.$domain.'): '.print_r($mxs, true)); |
|
| 291 | 291 | $this->domains_info[$domain] = []; |
| 292 | 292 | $this->domains_info[$domain]['users'] = $users; |
| 293 | 293 | $this->domains_info[$domain]['mxs'] = $mxs; |
@@ -338,7 +338,7 @@ discard block |
||
| 338 | 338 | } |
| 339 | 339 | } catch (NoConnectionException $e) { |
| 340 | 340 | // Unable to connect to host, so these addresses are invalid? |
| 341 | - $this->debug('Unable to connect. Exception caught: ' . $e->getMessage()); |
|
| 341 | + $this->debug('Unable to connect. Exception caught: '.$e->getMessage()); |
|
| 342 | 342 | //$this->setDomainResults($users, $domain, $this->no_conn_is_valid); |
| 343 | 343 | } |
| 344 | 344 | } |
@@ -352,7 +352,7 @@ discard block |
||
| 352 | 352 | // Say helo, and continue if we can talk |
| 353 | 353 | if ($this->helo()) { |
| 354 | 354 | // try issuing MAIL FROM |
| 355 | - if (!$this->mail($this->from_user . '@' . $this->from_domain)) { |
|
| 355 | + if (!$this->mail($this->from_user.'@'.$this->from_domain)) { |
|
| 356 | 356 | // MAIL FROM not accepted, we can't talk |
| 357 | 357 | $this->setDomainResults($users, $domain, $this->no_comm_is_valid); |
| 358 | 358 | } |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | $this->noop(); |
| 384 | 384 | // RCPT for each user |
| 385 | 385 | foreach ($users as $user) { |
| 386 | - $address = $user . '@' . $domain; |
|
| 386 | + $address = $user.'@'.$domain; |
|
| 387 | 387 | $this->results[$address] = $this->rcpt($address); |
| 388 | 388 | $this->noop(); |
| 389 | 389 | } |
@@ -439,7 +439,7 @@ discard block |
||
| 439 | 439 | private function setDomainResults(array $users, $domain, $val) |
| 440 | 440 | { |
| 441 | 441 | foreach ($users as $user) { |
| 442 | - $this->results[$user . '@' . $domain] = $val; |
|
| 442 | + $this->results[$user.'@'.$domain] = $val; |
|
| 443 | 443 | } |
| 444 | 444 | } |
| 445 | 445 | |
@@ -465,13 +465,13 @@ discard block |
||
| 465 | 465 | */ |
| 466 | 466 | protected function connect($host) |
| 467 | 467 | { |
| 468 | - $remote_socket = $host . ':' . $this->connect_port; |
|
| 468 | + $remote_socket = $host.':'.$this->connect_port; |
|
| 469 | 469 | $errnum = 0; |
| 470 | 470 | $errstr = ''; |
| 471 | 471 | $this->host = $remote_socket; |
| 472 | 472 | |
| 473 | 473 | // Open connection |
| 474 | - $this->debug('Connecting to ' . $this->host); |
|
| 474 | + $this->debug('Connecting to '.$this->host); |
|
| 475 | 475 | // @codingStandardsIgnoreLine |
| 476 | 476 | $this->socket = /** @scrutinizer ignore-unhandled */ @stream_socket_client( |
| 477 | 477 | $this->host, |
@@ -484,8 +484,8 @@ discard block |
||
| 484 | 484 | |
| 485 | 485 | // Check and throw if not connected |
| 486 | 486 | if (!$this->connected()) { |
| 487 | - $this->debug('Connect failed: ' . $errstr . ', error number: ' . $errnum . ', host: ' . $this->host); |
|
| 488 | - throw new NoConnectionException('Cannot open a connection to remote host (' . $this->host . ')'); |
|
| 487 | + $this->debug('Connect failed: '.$errstr.', error number: '.$errnum.', host: '.$this->host); |
|
| 488 | + throw new NoConnectionException('Cannot open a connection to remote host ('.$this->host.')'); |
|
| 489 | 489 | } |
| 490 | 490 | |
| 491 | 491 | $result = stream_set_timeout($this->socket, $this->connect_timeout); |
@@ -493,7 +493,7 @@ discard block |
||
| 493 | 493 | throw new NoTimeoutException('Cannot set timeout'); |
| 494 | 494 | } |
| 495 | 495 | |
| 496 | - $this->debug('Connected to ' . $this->host . ' successfully'); |
|
| 496 | + $this->debug('Connected to '.$this->host.' successfully'); |
|
| 497 | 497 | } |
| 498 | 498 | |
| 499 | 499 | /** |
@@ -510,7 +510,7 @@ discard block |
||
| 510 | 510 | } |
| 511 | 511 | |
| 512 | 512 | if ($this->connected()) { |
| 513 | - $this->debug('Closing socket to ' . $this->host); |
|
| 513 | + $this->debug('Closing socket to '.$this->host); |
|
| 514 | 514 | fclose($this->socket); |
| 515 | 515 | } |
| 516 | 516 | |
@@ -570,7 +570,7 @@ discard block |
||
| 570 | 570 | } catch (UnexpectedResponseException $e) { |
| 571 | 571 | // Connected, but got an unexpected response, so disconnect |
| 572 | 572 | $result = false; |
| 573 | - $this->debug('Unexpected response after connecting: ' . $e->getMessage()); |
|
| 573 | + $this->debug('Unexpected response after connecting: '.$e->getMessage()); |
|
| 574 | 574 | $this->disconnect(false); |
| 575 | 575 | } |
| 576 | 576 | |
@@ -586,11 +586,11 @@ discard block |
||
| 586 | 586 | { |
| 587 | 587 | try { |
| 588 | 588 | // Modern |
| 589 | - $this->send('EHLO ' . $this->from_domain); |
|
| 589 | + $this->send('EHLO '.$this->from_domain); |
|
| 590 | 590 | $this->expect(self::SMTP_GENERIC_SUCCESS, $this->command_timeouts['ehlo']); |
| 591 | 591 | } catch (UnexpectedResponseException $e) { |
| 592 | 592 | // Legacy |
| 593 | - $this->send('HELO ' . $this->from_domain); |
|
| 593 | + $this->send('HELO '.$this->from_domain); |
|
| 594 | 594 | $this->expect(self::SMTP_GENERIC_SUCCESS, $this->command_timeouts['helo']); |
| 595 | 595 | } |
| 596 | 596 | } |
@@ -611,7 +611,7 @@ discard block |
||
| 611 | 611 | } |
| 612 | 612 | |
| 613 | 613 | // Issue MAIL FROM, 5 minute timeout |
| 614 | - $this->send('MAIL FROM:<' . $from . '>'); |
|
| 614 | + $this->send('MAIL FROM:<'.$from.'>'); |
|
| 615 | 615 | |
| 616 | 616 | try { |
| 617 | 617 | $this->expect(self::SMTP_GENERIC_SUCCESS, $this->command_timeouts['mail']); |
@@ -625,7 +625,7 @@ discard block |
||
| 625 | 625 | $result = false; |
| 626 | 626 | |
| 627 | 627 | // Got something unexpected in response to MAIL FROM |
| 628 | - $this->debug("Unexpected response to MAIL FROM\n:" . $e->getMessage()); |
|
| 628 | + $this->debug("Unexpected response to MAIL FROM\n:".$e->getMessage()); |
|
| 629 | 629 | |
| 630 | 630 | // Hotmail has been known to do this + was closing the connection |
| 631 | 631 | // forcibly on their end, so we're killing the socket here too |
@@ -662,17 +662,17 @@ discard block |
||
| 662 | 662 | |
| 663 | 663 | // Issue RCPT TO, 5 minute timeout |
| 664 | 664 | try { |
| 665 | - $this->send('RCPT TO:<' . $to . '>'); |
|
| 665 | + $this->send('RCPT TO:<'.$to.'>'); |
|
| 666 | 666 | // Handle response |
| 667 | 667 | try { |
| 668 | 668 | $this->expect($expected_codes, $this->command_timeouts['rcpt']); |
| 669 | 669 | $this->state['rcpt'] = true; |
| 670 | 670 | $valid = true; |
| 671 | 671 | } catch (UnexpectedResponseException $e) { |
| 672 | - $this->debug('Unexpected response to RCPT TO: ' . $e->getMessage()); |
|
| 672 | + $this->debug('Unexpected response to RCPT TO: '.$e->getMessage()); |
|
| 673 | 673 | } |
| 674 | 674 | } catch (Exception $e) { |
| 675 | - $this->debug('Sending RCPT TO failed: ' . $e->getMessage()); |
|
| 675 | + $this->debug('Sending RCPT TO failed: '.$e->getMessage()); |
|
| 676 | 676 | } |
| 677 | 677 | |
| 678 | 678 | return $valid; |
@@ -711,7 +711,7 @@ discard block |
||
| 711 | 711 | if ($this->state['helo']) { |
| 712 | 712 | $this->send('QUIT'); |
| 713 | 713 | $this->expect( |
| 714 | - [self::SMTP_GENERIC_SUCCESS,self::SMTP_QUIT_SUCCESS], |
|
| 714 | + [self::SMTP_GENERIC_SUCCESS, self::SMTP_QUIT_SUCCESS], |
|
| 715 | 715 | $this->command_timeouts['quit'], |
| 716 | 716 | true |
| 717 | 717 | ); |
@@ -756,13 +756,13 @@ discard block |
||
| 756 | 756 | // Must be connected |
| 757 | 757 | $this->throwIfNotConnected(); |
| 758 | 758 | |
| 759 | - $this->debug('send>>>: ' . $cmd); |
|
| 759 | + $this->debug('send>>>: '.$cmd); |
|
| 760 | 760 | // Write the cmd to the connection stream |
| 761 | - $result = fwrite($this->socket, $cmd . self::CRLF); |
|
| 761 | + $result = fwrite($this->socket, $cmd.self::CRLF); |
|
| 762 | 762 | |
| 763 | 763 | // Did it work? |
| 764 | 764 | if (false === $result) { |
| 765 | - throw new SendFailedException('Send failed on: ' . $this->host); |
|
| 765 | + throw new SendFailedException('Send failed on: '.$this->host); |
|
| 766 | 766 | } |
| 767 | 767 | |
| 768 | 768 | return $result; |
@@ -791,7 +791,7 @@ discard block |
||
| 791 | 791 | |
| 792 | 792 | // Retrieve response |
| 793 | 793 | $line = fgets($this->socket, 1024); |
| 794 | - $this->debug('<<<recv: ' . $line); |
|
| 794 | + $this->debug('<<<recv: '.$line); |
|
| 795 | 795 | |
| 796 | 796 | // Have we timed out? |
| 797 | 797 | $info = stream_get_meta_data($this->socket); |
@@ -845,7 +845,7 @@ discard block |
||
| 845 | 845 | * No response in expect() probably means that the remote server |
| 846 | 846 | * forcibly closed the connection so lets clean up on our end as well? |
| 847 | 847 | */ |
| 848 | - $this->debug('No response in expect(): ' . $e->getMessage()); |
|
| 848 | + $this->debug('No response in expect(): '.$e->getMessage()); |
|
| 849 | 849 | $this->disconnect(false); |
| 850 | 850 | } |
| 851 | 851 | |
@@ -949,9 +949,9 @@ discard block |
||
| 949 | 949 | $this->log($str); |
| 950 | 950 | if ($this->debug) { |
| 951 | 951 | if ('cli' !== PHP_SAPI) { |
| 952 | - $str = '<br/><pre>' . htmlspecialchars($str) . '</pre>'; |
|
| 952 | + $str = '<br/><pre>'.htmlspecialchars($str).'</pre>'; |
|
| 953 | 953 | } |
| 954 | - echo "\n" . $str; |
|
| 954 | + echo "\n".$str; |
|
| 955 | 955 | } |
| 956 | 956 | } |
| 957 | 957 | |
@@ -977,7 +977,7 @@ discard block |
||
| 977 | 977 | private function stamp($msg) |
| 978 | 978 | { |
| 979 | 979 | $date = \DateTime::createFromFormat('U.u', sprintf('%.f', microtime(true)))->format('Y-m-d\TH:i:s.uO'); |
| 980 | - $line = '[' . $date . '] ' . $msg; |
|
| 980 | + $line = '['.$date.'] '.$msg; |
|
| 981 | 981 | |
| 982 | 982 | return $line; |
| 983 | 983 | } |
@@ -1016,7 +1016,7 @@ discard block |
||
| 1016 | 1016 | if (\method_exists($this, $camelized)) { |
| 1017 | 1017 | return \call_user_func_array([$this, $camelized], $args); |
| 1018 | 1018 | } else { |
| 1019 | - trigger_error('Fatal error: Call to undefined method ' . self::class . '::' . $name . '()', E_USER_ERROR); |
|
| 1019 | + trigger_error('Fatal error: Call to undefined method '.self::class.'::'.$name.'()', E_USER_ERROR); |
|
| 1020 | 1020 | } |
| 1021 | 1021 | } |
| 1022 | 1022 | |