Copied!

Dom node object.

Abstract
Methods
public __construct ()
 

Creates a unique id for this node.

public __destruct ()
 

Attempts to clear out any object references.

public __get ( string $key )
 

Magic get method for attributes and certain methods.

  • return mixed
public __toString () : string
 

Simply calls the outer text method.

  • return string
public ancestorByTag ( string $tag ) : PHPHtmlParser\Dom\AbstractNode
 

Function to locate a specific ancestor tag in the path to the root.

public delete ()
 

Removes this node and all its children from the
DOM tree.

  • return void
public find ( string $selector , ? int $nth = NULL , bool $depthFirst = false )
 

Find elements by css selector

public findById ( int $id )
 

Find node by id

public getAncestor ( int $id )
 

Attempts to get an ancestor node by the given id.

public getAttribute ( string $key ) : string
 

A wrapper method that simply calls the getAttribute method
on the tag of this node.

  • return string | null
public getAttributes () : array
 

A wrapper method that simply calls the getAttribute method
on the tag of this node.

  • return array
public getParent ()
 

Returns the parent of node.

public getTag () : PHPHtmlParser\Dom\Tag
 

Gets the tag object of this node.

public hasAttribute ( string $key ) : bool
 

A wrapper method that simply calls the hasAttribute method
on the tag of this node.

  • return bool
public hasNextSibling () : bool
 

Checks if the current node has a next sibling.

  • return bool
public id () : int
 

Returns the id of this object.

  • return int
public abstract innerHtml () : string
 

Gets the inner html of this node.

  • return string
public isAncestor ( int $id ) : bool
 

Checks if the given node id is an ancestor of
the current node.

  • return bool
public isTextNode () : bool
 

Check is node type textNode

  • return bool
public nextSibling () : PHPHtmlParser\Dom\AbstractNode
 

Attempts to get the next sibling.

public abstract outerHtml () : string
 

Gets the html of this node, including it's own
tag.

  • return string
public previousSibling () : PHPHtmlParser\Dom\AbstractNode
 

Attempts to get the previous sibling.

public propagateEncoding ( stringEncode\Encode $encode )
 

Sets the encoding class to this node.

  • return void
public removeAllAttributes () : void
 

A wrapper method that simply calls the removeAllAttributes
method on the tag of this node.

  • return void
public removeAttribute ( string $key ) : void
 

A wrapper method that simply calls the removeAttribute method
on the tag of this node.

  • return void
public static resetCount ()
 

Reset node counter

  • return void
public setAttribute ( string $key , $value ) : PHPHtmlParser\Dom\AbstractNode
 

A wrapper method that simply calls the setAttribute method
on the tag of this node.

public setHtmlSpecialCharsDecode ( $htmlSpecialCharsDecode = false ) : void
 
  • return void
public setParent ( PHPHtmlParser\Dom\InnerNode $parent ) : PHPHtmlParser\Dom\AbstractNode
 

Sets the parent node.

public abstract text () : string
 

Gets the text of this node (if there is any text).

  • return string
Properties
protected $attr
 

Contains a list of attributes on this tag.

  • var array
protected $children
 

An array of all the children.

  • var array
protected $encode
 

The encoding class used to encode strings.

  • var mixed
protected $htmlSpecialCharsDecode
 
  • var bool
protected $id
 

The unique id of the class. Given by PHP.

  • var int
protected $parent
 

Contains the parent Node.

  • var ?\InnerNode
protected $tag
 

Contains the tag name/type

  • var ?\Tag
Methods
protected abstract clear () : void
 

Call this when something in the node tree has changed. Like a child has been added
or a parent has been changed.

  • return void
Properties
private static $count
 
  • var int
Properties
private static $count
 
  • var int
Methods
public static resetCount ()
 

Reset node counter

  • return void
© 2020 Bruce Wells
Search Namespaces \ Classes
Configuration Numbers (0-9.) only