id = (string)$id; $this->pid = (string)$parentId; $this->name = $name; $this->children = $children; } public static function make( int $id, int $parentId, string $name, array $children = [] ): self { return new self($id, $parentId, $name, $children); } public function hasChildren(): bool { return !empty($this->children); } }