/** * Calculate indent of node (number of parent tags - 1) * @return int */ function indent() { return $this->parent ? $this->parent->indent() + 1 : -1; }