leenooks / phpLDAPadmin

phpLDAPadmin - Web based LDAP administration tool
www.phpldapadmin.org
GNU General Public License v2.0
539 stars 171 forks source link

Increase the usage of expressions with combined operators #142

Closed elfring closed 2 years ago

elfring commented 2 years ago

: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/lib/TemplateRender.php b/lib/TemplateRender.php
index 249c7a1..790c078 100644
--- a/lib/TemplateRender.php
+++ b/lib/TemplateRender.php
@@ -205,19 +205,19 @@ class TemplateRender extends PageRender {

                        switch ($operand) {
                            case '*':
-                               $next_number = $next_number * $operator;
+                               $next_number *= $operator;
                                break;

                            case '+':
-                               $next_number = $next_number + $operator;
+                               $next_number += $operator;
                                break;

                            case '-':
-                               $next_number = $next_number - $operator;
+                               $next_number -= $operator;
                                break;

                            case '/':
-                               $next_number = $next_number / $operator;
+                               $next_number /= $operator;
                                break;
                        }
                    }
diff --git a/lib/blowfish.php b/lib/blowfish.php
index 1c69aa9..636f841 100644
--- a/lib/blowfish.php
+++ b/lib/blowfish.php
@@ -320,7 +320,7 @@ class Horde_Cipher_blowfish {
                     $keyPos = 0;
                 }
             }
-            $this->p[$i] = $this->p[$i] ^ $keyXor;
+            $this->p[$i] ^= $keyXor;
         }

         $encZero = array('L' => 0, 'R' => 0);
diff --git a/lib/functions.php b/lib/functions.php
index 51d856a..255cd31 100644
--- a/lib/functions.php
+++ b/lib/functions.php
@@ -3017,7 +3017,7 @@ function littleEndian($hex) {

    $result = '';

-   for ($x=strlen($hex)-2;$x>= 0;$x=$x-2)
+   for ($x=strlen($hex)-2;$x>= 0;$x -=2)
        $result .= substr($hex,$x,2);

    return $result;
diff --git a/lib/schema_functions.php b/lib/schema_functions.php
index efa0cbc..b5a5493 100644
--- a/lib/schema_functions.php
+++ b/lib/schema_functions.php
@@ -159,9 +159,9 @@ class ObjectClass extends SchemaItem {
                    do {
                        $i++;
                        if (strlen($this->description) == 0)
-                           $this->description=$this->description.$strings[$i];
+                           $this->description .=$strings[$i];
                        else
-                           $this->description=$this->description.' '.$strings[$i];
+                           $this->description .=' '.$strings[$i];

                    } while (! preg_match('/\'$/s',$strings[$i]));

@@ -797,9 +797,9 @@ class AttributeType extends SchemaItem {
                    do {
                        $i++;
                        if (strlen($this->description)==0)
-                           $this->description=$this->description.$strings[$i];
+                           $this->description .=$strings[$i];
                        else
-                           $this->description=$this->description.' '.$strings[$i];
+                           $this->description .=' '.$strings[$i];
                    } while (! preg_match("/\'$/s",$strings[$i]));

                    if (DEBUG_ENABLED)
@@ -1302,9 +1302,9 @@ class Syntax extends SchemaItem {
                    do {
                        $i++;
                        if (strlen($this->description) == 0)
-                           $this->description=$this->description.$strings[$i];
+                           $this->description .=$strings[$i];
                        else
-                           $this->description=$this->description.' '.$strings[$i];
+                           $this->description .=' '.$strings[$i];
                    } while (! preg_match("/\'$/s",$strings[$i]));
                    break;

@@ -1378,9 +1378,9 @@ class MatchingRule extends SchemaItem {
                    do {
                        $i++;
                        if (strlen($this->description)==0)
-                           $this->description=$this->description.$strings[$i];
+                           $this->description .=$strings[$i];
                        else
-                           $this->description=$this->description.' '.$strings[$i];
+                           $this->description .=' '.$strings[$i];
                    } while (! preg_match("/\'$/s",$strings[$i]));
                    break;
leenooks commented 2 years ago

Thanks for the suggestion - considerations will be used for PLA v2.

elfring commented 2 years ago

How will change possibilities be tracked for PLA v2?