/** * Chainable setter for 'parent'. */ public function setParent(Token $parent = null) { $this->depth = 0; if ($parent instanceof Token) { $this->depth = $parent->getDepth() + 1; } $this->parent = $parent; return $this; }