mirror of
https://codeberg.org/vlw/functionflags.git
synced 2025-09-13 19:03:41 +02:00
fix: added some code comments and removed unused null
This commit is contained in:
parent
382e94f9cd
commit
5a6904b43f
1 changed files with 6 additions and 4 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue