Node
in package
implements
NodeInterface
FinalYes
Tags
Table of Contents
Interfaces
- NodeInterface
- Represents the sanitized version of a DOM node in the sanitized tree.
Constants
- VOID_ELEMENTS = ['area' => true, 'base' => true, 'br' => true, 'col' => true, 'embed' => true, 'hr' => true, 'img' => true, 'input' => true, 'keygen' => true, 'link' => true, 'meta' => true, 'param' => true, 'source' => true, 'track' => true, 'wbr' => true]
Properties
- $attributes : array<string|int, mixed>
- $children : array<string|int, mixed>
- $parent : NodeInterface
- $tagName : string
Methods
- __construct() : mixed
- addChild() : void
- Add a child node to this node.
- getAttribute() : string|null
- getParent() : NodeInterface|null
- Return the parent node of this node, or null if it has no parent node.
- render() : string
- Render this node as a string, recursively rendering its children as well.
- setAttribute() : void
- renderAttributes() : string
Constants
VOID_ELEMENTS
private
mixed
VOID_ELEMENTS
= ['area' => true, 'base' => true, 'br' => true, 'col' => true, 'embed' => true, 'hr' => true, 'img' => true, 'input' => true, 'keygen' => true, 'link' => true, 'meta' => true, 'param' => true, 'source' => true, 'track' => true, 'wbr' => true]
Properties
$attributes
private
array<string|int, mixed>
$attributes
= []
$children
private
array<string|int, mixed>
$children
= []
$parent
private
NodeInterface
$parent
$tagName
private
string
$tagName
Methods
__construct()
public
__construct(NodeInterface $parent, string $tagName) : mixed
Parameters
- $parent : NodeInterface
- $tagName : string
addChild()
Add a child node to this node.
public
addChild(NodeInterface $node) : void
Parameters
- $node : NodeInterface
getAttribute()
public
getAttribute(string $name) : string|null
Parameters
- $name : string
Return values
string|nullgetParent()
Return the parent node of this node, or null if it has no parent node.
public
getParent() : NodeInterface|null
Return values
NodeInterface|nullrender()
Render this node as a string, recursively rendering its children as well.
public
render() : string
Return values
stringsetAttribute()
public
setAttribute(string $name, string|null $value[, bool $override = false ]) : void
Parameters
- $name : string
- $value : string|null
- $override : bool = false
renderAttributes()
private
renderAttributes() : string