/** * {@inheritdoc} */ public function getDepth() { if ($this->parent === null) { return 0; } return $this->parent->getDepth() + 1; }
public function setParent(NodeInterface $parent) { $this->parent = $parent; $this->setDepth($parent->getDepth() + 1); }