Inheritance: extends ArrayNode
コード例 #1
0
 /**
  * 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);
 }
コード例 #2
0
ファイル: HtmlNode.php プロジェクト: paquettg/php-html-parser
 /**
  * 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();
 }
コード例 #3
0
 /**
  * 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);
 }