Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert eight variable assignments to the usage of combined operators #285

Open
elfring opened this issue Nov 26, 2021 · 0 comments
Open

Comments

@elfring
Copy link

elfring commented Nov 26, 2021

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

diff --git a/includes/ConfigHelper.php b/includes/ConfigHelper.php
index e0145dc..57965ad 100644
--- a/includes/ConfigHelper.php
+++ b/includes/ConfigHelper.php
@@ -532,13 +532,13 @@ final class ConfigHelper {
         ini_set('memory_limit', $memory_limit);
         if (preg_match('/G$/i',$memory_limit)) {
             $memory_limit = preg_replace('/G$/i','',$memory_limit);
-            $memory_limit = $memory_limit * 1024 * 1024 * 1024;
+            $memory_limit *= 1024 * 1024 * 1024;
         } else if (preg_match('/M$/i',$memory_limit)) {
             $memory_limit = preg_replace('/M$/i','',$memory_limit);
-            $memory_limit = $memory_limit * 1024 * 1024;
+            $memory_limit *= 1024 * 1024;
         } else if (preg_match('/K$/i',$memory_limit)) {
             $memory_limit = preg_replace('/K$/i','',$memory_limit);
-            $memory_limit = $memory_limit * 1024;
+            $memory_limit *= 1024;
         }
         Config::set(CONFIG_MEMORY_LIMIT, $memory_limit);
 
diff --git a/includes/StoragePool.php b/includes/StoragePool.php
index 9c538b2..2b85017 100644
--- a/includes/StoragePool.php
+++ b/includes/StoragePool.php
@@ -128,7 +128,7 @@ final class StoragePool {
             $body .= "\nA fsck will now start, to fix the symlinks found in your shares, when possible.\nYou'll receive a report email once that fsck run completes.\n";
             $drive_string = join(", ", $returned_drives);
             $subject = "Storage pool drive now online on " . exec ('hostname') . ": ";
-            $subject = $subject . $drive_string;
+            $subject .= $drive_string;
             if (strlen($subject) > 255) {
                 $subject = substr($subject, 0, 255);
             }
@@ -157,7 +157,7 @@ final class StoragePool {
             $body .= "A fsck will now start, to fix the symlinks found in your shares, when possible.\nYou'll receive a report email once that fsck run completes.\n";
             $subject = "Missing storage pool drives on " . exec('hostname') . ": ";
             $drive_string = join(",",$missing_drives);
-            $subject = $subject . $drive_string;
+            $subject .= $drive_string;
             if (strlen($subject) > 255) {
                 $subject = substr($subject, 0, 255);
             }
diff --git a/includes/common.php b/includes/common.php
index 519d295..b821cb9 100644
--- a/includes/common.php
+++ b/includes/common.php
@@ -209,7 +209,7 @@ function get_share_landing_zone($share) {
 function memory_check() {
     $usage = memory_get_usage();
     $used = $usage / Config::get(CONFIG_MEMORY_LIMIT);
-    $used = $used * 100;
+    $used *= 100;
     if ($used > 95) {
         Log::critical("$used% memory usage, exiting. Please increase '" . CONFIG_MEMORY_LIMIT . "' in " . ConfigHelper::$config_file, Log::EVENT_CODE_MEMORY_LIMIT_REACHED);
     }
@@ -934,9 +934,9 @@ function how_long_ago($past_time) {
             $ago = $h . "h ";
             $m -= $h * 60;
         }
-        $ago = $ago . $m . "m ";
+        $ago .= $m . "m ";
     }
-    $ago = $ago . $s . "s";
+    $ago .= $s . "s";
     if ($ago == '0s') {
         return 'just now';
     }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant