php-epp-client icon indicating copy to clipboard operation
php-epp-client copied to clipboard

Convert four variable assignments to the usage of combined operators

Open elfring opened this issue 3 years ago • 0 comments
trafficstars

:eyes: Some source code analysis tools can help to find opportunities for improving software components. :thought_balloon: I propose to increase the usage of combined operators accordingly.

diff --git a/Protocols/EPP/eppConnection.php b/Protocols/EPP/eppConnection.php
index 1c5fdf2..3076bac 100755
--- a/Protocols/EPP/eppConnection.php
+++ b/Protocols/EPP/eppConnection.php
@@ -555,7 +555,7 @@ class eppConnection {
                 while ($readLength > 0) {
 //                    $loops++;
                     if ($readbuffer = fread($this->connection, $readLength)) {
-                        $readLength = $readLength - strlen($readbuffer);
+                        $readLength -= strlen($readbuffer);
                         $read .= $readbuffer;
                         $time = time() + $this->timeout;
                     } elseif ($useSleep) {
@@ -588,7 +588,7 @@ class eppConnection {
                 $time = time() + $this->timeout;
                 if ($read = fread($this->connection, $length)) {
                     //$this->writeLog(print_R(socket_get_status($this->connection), true));
-                    $length = $length - strlen($read);
+                    $length -= strlen($read);
                     $content .= $read;
                     $time = time() + $this->timeout;
                 }
diff --git a/Tests/lvEppContactExtTest.php b/Tests/lvEppContactExtTest.php
index f1c3021..14c3839 100644
--- a/Tests/lvEppContactExtTest.php
+++ b/Tests/lvEppContactExtTest.php
@@ -198,7 +198,7 @@ class lvEppContactExtTest extends eppTestCase {
         }
 
         // success
-        $startpos = $startpos + strlen($start);
+        $startpos += strlen($start);
         $length = $endpos - $startpos;
         $text = substr($text, $startpos, $length);
 
diff --git a/Tests/lvEppDomainExtTest.php b/Tests/lvEppDomainExtTest.php
index f3516eb..436f11b 100644
--- a/Tests/lvEppDomainExtTest.php
+++ b/Tests/lvEppDomainExtTest.php
@@ -196,7 +196,7 @@ class lvEppDomainExtTest extends eppTestCase {
         }
 
         // success
-        $startpos = $startpos + strlen($start);
+        $startpos += strlen($start);
         $length = $endpos - $startpos;
         $text = substr($text, $startpos, $length);
 

elfring avatar Nov 26 '21 19:11 elfring