Greyhole
Greyhole copied to clipboard
Convert eight variable assignments to the usage of combined operators
: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/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';
}