fix: added some code comments and removed unused null

This commit is contained in:
Victor Westerlund 2023-04-18 20:26:30 +02:00
parent 382e94f9cd
commit 5a6904b43f

View file

@ -126,13 +126,14 @@
} }
// Check if a flag is set with bitwise AND of all flags // Check if a flag is set with bitwise AND of all flags
private static function static_isset(int $flag): bool|null { private static function static_isset(int $flag): bool {
$flags = (__CLASS__)::get_flags_from_caller(); $flags = (__CLASS__)::get_flags_from_caller();
return $flags ? $flags & $flag : null; return $flags ? $flags & $flag : false;
} }
/* ---- */ /* ---- */
// Define flag(s) for $this instance
private function inst_define(string|array $flags) { private function inst_define(string|array $flags) {
// Convert to array // Convert to array
$flags = is_array($flags) ? $flags : [$flags]; $flags = is_array($flags) ? $flags : [$flags];
@ -141,8 +142,9 @@
$this->flags = array_merge($this->flags, $this::static_define($flags)); $this->flags = array_merge($this->flags, $this::static_define($flags));
} }
// Check if flag is set within instance scope // Check if flag is set and within $this scope
private function inst_isset(int $flag): bool|null { private function inst_isset(int $flag): bool {
// Return false if the flag is not in scope of $this instance
if (!in_array($flag, $this->flags)) { if (!in_array($flag, $this->flags)) {
return false; return false;
} }