ÂMemoryManager: replace switch with match

This commit is contained in:
Dylan K. Taylor 2022-12-23 17:36:08 +00:00
parent 17125ce0e3
commit 4c91c4aaf1
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -113,20 +113,12 @@ class MemoryManager{
if($m <= 0){
$defaultMemory = 0;
}else{
switch(mb_strtoupper($matches[2])){
case "K":
$defaultMemory = intdiv($m, 1024);
break;
case "M":
$defaultMemory = $m;
break;
case "G":
$defaultMemory = $m * 1024;
break;
default:
$defaultMemory = $m;
break;
}
$defaultMemory = match(mb_strtoupper($matches[2])){
"K" => intdiv($m, 1024),
"M" => $m,
"G" => $m * 1024,
default => $m,
};
}
}