userId = $result->isNull(0) ? null : $result->getInteger(0); $this->roleId = $result->isNull(1) ? null : $result->getInteger(1); $this->forumCategoryId = $result->isNull(2) ? null : $result->getInteger(2); $this->category = $result->getString(3); $this->allow = $result->getInteger(4); $this->deny = $result->getInteger(5); $this->calculated = $this->allow & ~$this->deny; } public function hasUserId(): bool { return $this->userId !== null; } public function getUserId(): ?string { return $this->userId; } public function hasRoleId(): bool { return $this->roleId !== null; } public function getRoleId(): ?string { return $this->roleId; } public function hasForumCategoryId(): bool { return $this->forumCategoryId !== null; } public function getForumCategoryId(): ?string { return $this->forumCategoryId; } public function getCategory(): string { return $this->category; } public function getAllow(): int { return $this->allow; } public function getDeny(): int { return $this->deny; } public function getCalculated(): int { return $this->calculated; } public function check(int $perm): bool { return ($this->calculated & $perm) > 0; } public function checkAllow(int $perm): bool { return ($this->allow & $perm) > 0; } public function checkDeny(int $perm): bool { return ($this->deny & $perm) > 0; } public function checkNeutral(int $perm): bool { return ($this->allow & $perm) === 0 && ($this->deny & $perm) === 0; } }