. */ declare(strict_types=1); namespace App\Entity\Contracts; use Doctrine\Common\Collections\Collection; /** * Interface for structural elements that form a tree hierarchy. */ interface StructuralElementInterface { /** * Get the parent of this element. * * @return static|null The parent element. Null if this element does not have a parent. */ public function getParent(): ?self; /** * Get all sub elements of this element. * * @return Collection|iterable all subelements */ public function getChildren(): iterable; /** * Checks if this element is a root element (has no parent). * * @return bool true if this element is a root element */ public function isRoot(): bool; /** * Get the full path. * * @param string $delimiter the delimiter of the returned string * * @return string the full path (incl. the name of this element), delimited by $delimiter */ public function getFullPath(string $delimiter = ' → '): string; /** * Get the level. * * The level of the root node is -1. * * @return int the level of this element (zero means the topmost element) */ public function getLevel(): int; }