[UTILS] Make bitmap not use a static class var and set object properties as lowercase
This commit is contained in:
parent
147ff89e74
commit
179d7f3335
@ -23,8 +23,6 @@ use App\Util\Exception\ServerException;
|
|||||||
|
|
||||||
abstract class Bitmap
|
abstract class Bitmap
|
||||||
{
|
{
|
||||||
public static $consts = null;
|
|
||||||
|
|
||||||
public static function _do(int $r, bool $instance)
|
public static function _do(int $r, bool $instance)
|
||||||
{
|
{
|
||||||
$init = $r;
|
$init = $r;
|
||||||
@ -35,14 +33,13 @@ abstract class Bitmap
|
|||||||
$vals = [];
|
$vals = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self::$consts == null) {
|
$consts = (new \ReflectionClass($class))->getConstants();
|
||||||
self::$consts = (new \ReflectionClass($class))->getConstants();
|
unset($consts['PREFIX']);
|
||||||
unset(self::$consts['PREFIX']);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (self::$consts as $c => $v) {
|
foreach ($consts as $c => $v) {
|
||||||
$b = ($r & $v) !== 0;
|
$b = ($r & $v) !== 0;
|
||||||
if ($instance) {
|
if ($instance) {
|
||||||
|
$c = strtolower($c);
|
||||||
$obj->{$c} = $b;
|
$obj->{$c} = $b;
|
||||||
}
|
}
|
||||||
if ($b) {
|
if ($b) {
|
||||||
|
Loading…
Reference in New Issue
Block a user