/** * Attempts to get the previous sibling * * @return AbstractNode * @throws ParentNotFoundException */ public function previousSibling() { if (is_null($this->parent)) { throw new ParentNotFoundException('Parent is not set for this node.'); } return $this->parent->previousChild($this->id); }
/** * Sets up the tag of this node. * * @param $tag */ public function __construct($tag) { if (!$tag instanceof Tag) { $tag = new Tag($tag); } $this->tag = $tag; parent::__construct(); }
/** * Sets the parent node. * * @param InnerNode $parent * @return $this * @throws CircularException */ public function setParent(InnerNode $parent) { // check integrity if ($this->isDescendant($parent->id())) { throw new CircularException('Can not add descendant "' . $parent->id() . '" as my parent.'); } return parent::setParent($parent); }