source = $source; } public function setId(int $id): void { throw \Exception("The id can't be changed!"); } public function setRelation(RelationInterface $relation): void { throw \Exception("The node can't be changed!"); } public function getId(): int { if ($this->isGranted(RightType::READ)) { return $source->getId(); } } public function getRelation(): Relation { if ($this->isGranted(RightType::READ, LayerType::NODE)) { return $source->getNode(); } } protected function isGranted(string $right, string $layer): bool { return $this->getNode() ->getLaw() ->isGranted(self::$user->getSource() ->getNode(), self::$layer, $right); } protected function lazyLoadSourceFacade(SourceInterface $source) { } public function __toString(): string { return $this->source->__toString(); } }