PHP Класс PHPHtmlParser\Dom\AbstractNode

Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$attr array Contains a list of attributes on this tag.
$encode mixed The encoding class used to encode strings.
$id string The unique id of the class. Given by PHP.
$parent InnerNode Contains the parent Node.
$tag Tag Contains the tag name/type

Открытые методы

Метод Описание
__construct ( ) Creates a unique spl hash for this node.
__destruct ( ) Attempts to clear out any object references.
__get ( string $key ) : mixed Magic get method for attributes and certain methods.
__toString ( ) : string Simply calls the outer text method.
ancestorByTag ( string $tag ) : AbstractNode Function to locate a specific ancestor tag in the path to the root.
delete ( ) : void Removes this node and all its children from the DOM tree.
find ( string $selector, integer $nth = null ) : array | AbstractNode Find elements by css selector
getAncestor ( integer $id ) : null | AbstractNode Attempts to get an ancestor node by the given id.
getAttribute ( string $key ) : mixed A wrapper method that simply calls the getAttribute method on the tag of this node.
getAttributes ( ) : array A wrapper method that simply calls the getAttribute method on the tag of this node.
getParent ( ) : AbstractNode Returns the parent of node.
getTag ( ) : Tag Gets the tag object of this node.
id ( ) Returns the id of this object.
innerHtml ( ) : string Gets the inner html of this node.
isAncestor ( integer $id ) : boolean Checks if the given node id is an ancestor of the current node.
nextSibling ( ) : AbstractNode Attempts to get the next sibling.
outerHtml ( ) : string Gets the html of this node, including it's own tag.
previousSibling ( ) : AbstractNode Attempts to get the previous sibling
propagateEncoding ( stringEncode\Encode $encode ) : void Sets the encoding class to this node.
removeAllAttributes ( ) : void A wrapper method that simply calls the removeAllAttributes method on the tag of this node.
removeAttribute ( string $key ) : void A wrapper method that simply calls the removeAttribute method on the tag of this node.
setAttribute ( string $key, string $value ) A wrapper method that simply calls the setAttribute method on the tag of this node.
setParent ( InnerNode $parent ) Sets the parent node.
text ( ) : string Gets the text of this node (if there is any text).

Защищенные методы

Метод Описание
clear ( ) : void Call this when something in the node tree has changed. Like a child has been added or a parent has been changed.

Описание методов

__construct() публичный Метод

Creates a unique spl hash for this node.
public __construct ( )

__destruct() публичный Метод

Attempts to clear out any object references.
public __destruct ( )

__get() публичный Метод

Magic get method for attributes and certain methods.
public __get ( string $key ) : mixed
$key string
Результат mixed

__toString() публичный Метод

Simply calls the outer text method.
public __toString ( ) : string
Результат string

ancestorByTag() публичный Метод

Function to locate a specific ancestor tag in the path to the root.
public ancestorByTag ( string $tag ) : AbstractNode
$tag string
Результат AbstractNode

clear() абстрактный защищенный Метод

Call this when something in the node tree has changed. Like a child has been added or a parent has been changed.
abstract protected clear ( ) : void
Результат void

delete() публичный Метод

Removes this node and all its children from the DOM tree.
public delete ( ) : void
Результат void

find() публичный Метод

Find elements by css selector
public find ( string $selector, integer $nth = null ) : array | AbstractNode
$selector string
$nth integer
Результат array | AbstractNode

getAncestor() публичный Метод

Attempts to get an ancestor node by the given id.
public getAncestor ( integer $id ) : null | AbstractNode
$id integer
Результат null | AbstractNode

getAttribute() публичный Метод

A wrapper method that simply calls the getAttribute method on the tag of this node.
public getAttribute ( string $key ) : mixed
$key string
Результат mixed

getAttributes() публичный Метод

A wrapper method that simply calls the getAttribute method on the tag of this node.
public getAttributes ( ) : array
Результат array

getParent() публичный Метод

Returns the parent of node.
public getParent ( ) : AbstractNode
Результат AbstractNode

getTag() публичный Метод

Gets the tag object of this node.
public getTag ( ) : Tag
Результат Tag

id() публичный Метод

Returns the id of this object.
public id ( )

innerHtml() абстрактный публичный Метод

Gets the inner html of this node.
abstract public innerHtml ( ) : string
Результат string

isAncestor() публичный Метод

Checks if the given node id is an ancestor of the current node.
public isAncestor ( integer $id ) : boolean
$id integer
Результат boolean

nextSibling() публичный Метод

Attempts to get the next sibling.
public nextSibling ( ) : AbstractNode
Результат AbstractNode

outerHtml() абстрактный публичный Метод

Gets the html of this node, including it's own tag.
abstract public outerHtml ( ) : string
Результат string

previousSibling() публичный Метод

Attempts to get the previous sibling
public previousSibling ( ) : AbstractNode
Результат AbstractNode

propagateEncoding() публичный Метод

Sets the encoding class to this node.
public propagateEncoding ( stringEncode\Encode $encode ) : void
$encode stringEncode\Encode
Результат void

removeAllAttributes() публичный Метод

A wrapper method that simply calls the removeAllAttributes method on the tag of this node.
public removeAllAttributes ( ) : void
Результат void

removeAttribute() публичный Метод

A wrapper method that simply calls the removeAttribute method on the tag of this node.
public removeAttribute ( string $key ) : void
$key string
Результат void

setAttribute() публичный Метод

A wrapper method that simply calls the setAttribute method on the tag of this node.
public setAttribute ( string $key, string $value )
$key string
$value string

setParent() публичный Метод

Sets the parent node.
public setParent ( InnerNode $parent )
$parent InnerNode

text() абстрактный публичный Метод

Gets the text of this node (if there is any text).
abstract public text ( ) : string
Результат string

Описание свойств

$attr защищенное свойство

Contains a list of attributes on this tag.
protected array $attr
Результат array

$encode защищенное свойство

The encoding class used to encode strings.
protected mixed $encode
Результат mixed

$id защищенное свойство

The unique id of the class. Given by PHP.
protected string $id
Результат string

$parent защищенное свойство

Contains the parent Node.
protected InnerNode,PHPHtmlParser\Dom $parent
Результат InnerNode

$tag защищенное свойство

Contains the tag name/type
protected Tag,PHPHtmlParser\Dom $tag
Результат Tag