/** * Gets the nodes depth. * * @return int */ public function getDepth() { if ($this->parent === null) { return 0; } return $this->parent->getDepth() + 1; }
/** * Constructor. */ public function __construct(Node $node) { parent::__construct($node->getChildren()); }