From 179d7f3335a6a6b91add6df36450c36a768c8863 Mon Sep 17 00:00:00 2001 From: Hugo Sales Date: Thu, 10 Sep 2020 22:28:50 +0000 Subject: [PATCH] [UTILS] Make bitmap not use a static class var and set object properties as lowercase --- src/Util/Bitmap.php | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/Util/Bitmap.php b/src/Util/Bitmap.php index d84f698272..5db951e70e 100644 --- a/src/Util/Bitmap.php +++ b/src/Util/Bitmap.php @@ -23,8 +23,6 @@ use App\Util\Exception\ServerException; abstract class Bitmap { - public static $consts = null; - public static function _do(int $r, bool $instance) { $init = $r; @@ -35,14 +33,13 @@ abstract class Bitmap $vals = []; } - if (self::$consts == null) { - self::$consts = (new \ReflectionClass($class))->getConstants(); - unset(self::$consts['PREFIX']); - } + $consts = (new \ReflectionClass($class))->getConstants(); + unset($consts['PREFIX']); - foreach (self::$consts as $c => $v) { + foreach ($consts as $c => $v) { $b = ($r & $v) !== 0; if ($instance) { + $c = strtolower($c); $obj->{$c} = $b; } if ($b) {