src/Blocks/Lists/Tree/Builder.php
public function addItem(BlockInterface $block)
    {
        $lineContent = $block->getContent();

        $item = $this->createItem();
        $item->setContent($lineContent);
        $item->setId($block->getLineNumber());
        $level = $this->getLevelByContent($lineContent);
        $item->setLevel($level);

        $this->itemsRegistry->addItem($item);

        $this->addToTreeStructure($item, $level);

        $this->levelLastItem[$level] = $item->getId();

        return $item;
    }
public function addItem(BlockInterface $block)
    {
        $lineContent = $block->getContent();

        $item = $this->createItem();
        $item->setContent($lineContent);
        $item->setId($block->getLineNumber());
        $level = $this->getLevelByContent($lineContent);
        $item->setLevel($level);

        $this->itemsRegistry->addItem($item);

        $this->addToTreeStructure($item, $level);

        $this->levelLastItem[$level] = $item->getId();

        return $item;
    }
@param BlockInterface $block

@return ItemInterface