Passed
Push — master ( 6c1142...03ac2d )
by zyt
06:13 queued 01:37
created
src/Validator.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -223,8 +223,8 @@  discard block
 block discarded – undo
223 223
             return false;
224 224
         }
225 225
 
226
-        $test     = 'catch-all-test-' . time();
227
-        $accepted = $this->rcpt($test . '@' . $domain);
226
+        $test     = 'catch-all-test-'.time();
227
+        $accepted = $this->rcpt($test.'@'.$domain);
228 228
         if ($accepted) {
229 229
             // Success on a non-existing address is a "catch-all"
230 230
             $this->domains_info[$domain]['catchall'] = true;
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
         // Log when we get disconnected while trying catchall detection
235 235
         $this->noop();
236 236
         if (!$this->connected()) {
237
-            $this->debug('Disconnected after trying a non-existing recipient on ' . $domain);
237
+            $this->debug('Disconnected after trying a non-existing recipient on '.$domain);
238 238
         }
239 239
 
240 240
         /**
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
             // Add the hostname itself with 0 weight (RFC 2821)
284 284
             $mxs[$domain] = 0;
285 285
 
286
-            $this->debug('MX records (' . $domain . '): ' . print_r($mxs, true));
286
+            $this->debug('MX records ('.$domain.'): '.print_r($mxs, true));
287 287
             $this->domains_info[$domain]          = [];
288 288
             $this->domains_info[$domain]['users'] = $users;
289 289
             $this->domains_info[$domain]['mxs']   = $mxs;
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
                     }
299 299
                 } catch (NoConnectionException $e) {
300 300
                     // Unable to connect to host, so these addresses are invalid?
301
-                    $this->debug('Unable to connect. Exception caught: ' . $e->getMessage());
301
+                    $this->debug('Unable to connect. Exception caught: '.$e->getMessage());
302 302
                     $this->setDomainResults($users, $domain, $this->no_conn_is_valid);
303 303
                 }
304 304
             }
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
                     // Say helo, and continue if we can talk
310 310
                     if ($this->helo()) {
311 311
                         // try issuing MAIL FROM
312
-                        if (!$this->mail($this->from_user . '@' . $this->from_domain)) {
312
+                        if (!$this->mail($this->from_user.'@'.$this->from_domain)) {
313 313
                             // MAIL FROM not accepted, we can't talk
314 314
                             $this->setDomainResults($users, $domain, $this->no_comm_is_valid);
315 315
                         }
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
                                 $this->noop();
341 341
                                 // RCPT for each user
342 342
                                 foreach ($users as $user) {
343
-                                    $address                 = $user . '@' . $domain;
343
+                                    $address                 = $user.'@'.$domain;
344 344
                                     $this->results[$address] = $this->rcpt($address);
345 345
                                     $this->noop();
346 346
                                 }
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
     private function setDomainResults(array $users, $domain, $val)
403 403
     {
404 404
         foreach ($users as $user) {
405
-            $this->results[$user . '@' . $domain] = $val;
405
+            $this->results[$user.'@'.$domain] = $val;
406 406
         }
407 407
     }
408 408
 
@@ -428,13 +428,13 @@  discard block
 block discarded – undo
428 428
      */
429 429
     protected function connect($host)
430 430
     {
431
-        $remote_socket = $host . ':' . $this->connect_port;
431
+        $remote_socket = $host.':'.$this->connect_port;
432 432
         $errnum        = 0;
433 433
         $errstr        = '';
434 434
         $this->host    = $remote_socket;
435 435
 
436 436
         // Open connection
437
-        $this->debug('Connecting to ' . $this->host);
437
+        $this->debug('Connecting to '.$this->host);
438 438
         // @codingStandardsIgnoreLine
439 439
         $this->socket = /** @scrutinizer ignore-unhandled */ @stream_socket_client(
440 440
             $this->host,
@@ -447,8 +447,8 @@  discard block
 block discarded – undo
447 447
 
448 448
         // Check and throw if not connected
449 449
         if (!$this->connected()) {
450
-            $this->debug('Connect failed: ' . $errstr . ', error number: ' . $errnum . ', host: ' . $this->host);
451
-            throw new NoConnectionException('Cannot open a connection to remote host (' . $this->host . ')');
450
+            $this->debug('Connect failed: '.$errstr.', error number: '.$errnum.', host: '.$this->host);
451
+            throw new NoConnectionException('Cannot open a connection to remote host ('.$this->host.')');
452 452
         }
453 453
 
454 454
         $result = stream_set_timeout($this->socket, $this->connect_timeout);
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
             throw new NoTimeoutException('Cannot set timeout');
457 457
         }
458 458
 
459
-        $this->debug('Connected to ' . $this->host . ' successfully');
459
+        $this->debug('Connected to '.$this->host.' successfully');
460 460
     }
461 461
 
462 462
     /**
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
         }
474 474
 
475 475
         if ($this->connected()) {
476
-            $this->debug('Closing socket to ' . $this->host);
476
+            $this->debug('Closing socket to '.$this->host);
477 477
             fclose($this->socket);
478 478
         }
479 479
 
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
         } catch (UnexpectedResponseException $e) {
534 534
             // Connected, but got an unexpected response, so disconnect
535 535
             $result = false;
536
-            $this->debug('Unexpected response after connecting: ' . $e->getMessage());
536
+            $this->debug('Unexpected response after connecting: '.$e->getMessage());
537 537
             $this->disconnect(false);
538 538
         }
539 539
 
@@ -549,11 +549,11 @@  discard block
 block discarded – undo
549 549
     {
550 550
         try {
551 551
             // Modern
552
-            $this->send('EHLO ' . $this->from_domain);
552
+            $this->send('EHLO '.$this->from_domain);
553 553
             $this->expect(self::SMTP_GENERIC_SUCCESS, $this->command_timeouts['ehlo']);
554 554
         } catch (UnexpectedResponseException $e) {
555 555
             // Legacy
556
-            $this->send('HELO ' . $this->from_domain);
556
+            $this->send('HELO '.$this->from_domain);
557 557
             $this->expect(self::SMTP_GENERIC_SUCCESS, $this->command_timeouts['helo']);
558 558
         }
559 559
     }
@@ -574,7 +574,7 @@  discard block
 block discarded – undo
574 574
         }
575 575
 
576 576
         // Issue MAIL FROM, 5 minute timeout
577
-        $this->send('MAIL FROM:<' . $from . '>');
577
+        $this->send('MAIL FROM:<'.$from.'>');
578 578
 
579 579
         try {
580 580
             $this->expect(self::SMTP_GENERIC_SUCCESS, $this->command_timeouts['mail']);
@@ -588,7 +588,7 @@  discard block
 block discarded – undo
588 588
             $result = false;
589 589
 
590 590
             // Got something unexpected in response to MAIL FROM
591
-            $this->debug("Unexpected response to MAIL FROM\n:" . $e->getMessage());
591
+            $this->debug("Unexpected response to MAIL FROM\n:".$e->getMessage());
592 592
 
593 593
             // Hotmail has been known to do this + was closing the connection
594 594
             // forcibly on their end, so we're killing the socket here too
@@ -625,17 +625,17 @@  discard block
 block discarded – undo
625 625
 
626 626
         // Issue RCPT TO, 5 minute timeout
627 627
         try {
628
-            $this->send('RCPT TO:<' . $to . '>');
628
+            $this->send('RCPT TO:<'.$to.'>');
629 629
             // Handle response
630 630
             try {
631 631
                 $this->expect($expected_codes, $this->command_timeouts['rcpt']);
632 632
                 $this->state['rcpt'] = true;
633 633
                 $valid               = true;
634 634
             } catch (UnexpectedResponseException $e) {
635
-                $this->debug('Unexpected response to RCPT TO: ' . $e->getMessage());
635
+                $this->debug('Unexpected response to RCPT TO: '.$e->getMessage());
636 636
             }
637 637
         } catch (Exception $e) {
638
-            $this->debug('Sending RCPT TO failed: ' . $e->getMessage());
638
+            $this->debug('Sending RCPT TO failed: '.$e->getMessage());
639 639
         }
640 640
 
641 641
         return $valid;
@@ -674,7 +674,7 @@  discard block
 block discarded – undo
674 674
         if ($this->state['helo']) {
675 675
             $this->send('QUIT');
676 676
             $this->expect(
677
-                [self::SMTP_GENERIC_SUCCESS,self::SMTP_QUIT_SUCCESS],
677
+                [self::SMTP_GENERIC_SUCCESS, self::SMTP_QUIT_SUCCESS],
678 678
                 $this->command_timeouts['quit'],
679 679
                 true
680 680
             );
@@ -719,13 +719,13 @@  discard block
 block discarded – undo
719 719
         // Must be connected
720 720
         $this->throwIfNotConnected();
721 721
 
722
-        $this->debug('send>>>: ' . $cmd);
722
+        $this->debug('send>>>: '.$cmd);
723 723
         // Write the cmd to the connection stream
724
-        $result = fwrite($this->socket, $cmd . self::CRLF);
724
+        $result = fwrite($this->socket, $cmd.self::CRLF);
725 725
 
726 726
         // Did it work?
727 727
         if (false === $result) {
728
-            throw new SendFailedException('Send failed on: ' . $this->host);
728
+            throw new SendFailedException('Send failed on: '.$this->host);
729 729
         }
730 730
 
731 731
         return $result;
@@ -754,7 +754,7 @@  discard block
 block discarded – undo
754 754
 
755 755
         // Retrieve response
756 756
         $line = fgets($this->socket, 1024);
757
-        $this->debug('<<<recv: ' . $line);
757
+        $this->debug('<<<recv: '.$line);
758 758
 
759 759
         // Have we timed out?
760 760
         $info = stream_get_meta_data($this->socket);
@@ -808,7 +808,7 @@  discard block
 block discarded – undo
808 808
              * No response in expect() probably means that the remote server
809 809
              * forcibly closed the connection so lets clean up on our end as well?
810 810
              */
811
-            $this->debug('No response in expect(): ' . $e->getMessage());
811
+            $this->debug('No response in expect(): '.$e->getMessage());
812 812
             $this->disconnect(false);
813 813
         }
814 814
 
@@ -912,9 +912,9 @@  discard block
 block discarded – undo
912 912
         $this->log($str);
913 913
         if ($this->debug) {
914 914
             if ('cli' !== PHP_SAPI) {
915
-                $str = '<br/><pre>' . htmlspecialchars($str) . '</pre>';
915
+                $str = '<br/><pre>'.htmlspecialchars($str).'</pre>';
916 916
             }
917
-            echo "\n" . $str;
917
+            echo "\n".$str;
918 918
         }
919 919
     }
920 920
 
@@ -940,7 +940,7 @@  discard block
 block discarded – undo
940 940
     private function stamp($msg)
941 941
     {
942 942
         $date = \DateTime::createFromFormat('U.u', sprintf('%.f', microtime(true)))->format('Y-m-d\TH:i:s.uO');
943
-        $line = '[' . $date . '] ' . $msg;
943
+        $line = '['.$date.'] '.$msg;
944 944
 
945 945
         return $line;
946 946
     }
@@ -979,7 +979,7 @@  discard block
 block discarded – undo
979 979
         if (\method_exists($this, $camelized)) {
980 980
             return \call_user_func_array([$this, $camelized], $args);
981 981
         } else {
982
-            trigger_error('Fatal error: Call to undefined method ' . self::class . '::' . $name . '()', E_USER_ERROR);
982
+            trigger_error('Fatal error: Call to undefined method '.self::class.'::'.$name.'()', E_USER_ERROR);
983 983
         }
984 984
     }
985 985
 
Please login to merge, or discard this patch.