src/Leevel/Tree/Tree.php
public function setNode($id, $parent, $value, bool $priority = false): void
    {
        $this->data[$id] = $value;

        if ($priority) {
            $tmp = [
                $id => $parent,
            ];

            foreach ($this->map as $key => $value) {
                $tmp[$key] = $value;
            }

            $this->map = $tmp;

            unset($tmp);
        } else {
            $this->map[$id] = $parent;
        }
    }
public function setNode($id, $parent, $value, bool $priority = false): void
    {
        $this->data[$id] = $value;

        if ($priority) {
            $tmp = [
                $id => $parent,
            ];

            foreach ($this->map as $key => $value) {
                $tmp[$key] = $value;
            }

            $this->map = $tmp;

            unset($tmp);
        } else {
            $this->map[$id] = $parent;
        }
    }
设置节点数据.

@param int|string $id
@param int|string $parent
@param mixed      $value
@param bool       $priority