grant = true; //$this->node = new Node(); //$this->recieverGroup = new RecieverGroup(); } public function isGranted(RelationInterface $relation, string $layer, string $right): bool { if ($this->layer == $layer && $this->type == $right && $this->checkIfNodeIsReciever($relation) && $this->getConditionBoolOrTrue()) { return $this->grant; } return !($this->grant); } private function getConditionBoolOrTrue(): bool { if ($this->hasCondition()) { return $this->condition->getResult()->getBool(); } return true; } private function checkIfNodeIsReciever(RelationInterface $relation): bool { return $this->recieverGroup->getAllRecievers()->contains($relation); } }