DOMDocumentPlugin
extends Plugin
in package
The DOMDocument parser plugin is particularly useful as it is both the only way to see inside the DOMNode without print_r, and the only way to see mixed text and node inside XML (SimpleXMLElement will strip out the text).
Table of Contents
- $blacklist : array<string|int, mixed>
- List of properties to skip parsing.
- $verbose : bool
- Show all properties and methods.
- $parser : mixed
- getTriggers() : mixed
- getTypes() : array<string|int, mixed>
- An array of types (As returned by gettype) for all data this plugin can operate on.
- parse() : mixed
- setParser() : mixed
- parseList() : mixed
- parseNode() : mixed
- parseProperty() : mixed
- textualNodeToString() : mixed
Properties
$blacklist
List of properties to skip parsing.
public
static array<string|int, mixed>
$blacklist
= array('parentNode' => 'DOMNode', 'firstChild' => 'DOMNode', 'lastChild' => 'DOMNode', 'previousSibling' => 'DOMNode', 'nextSibling' => 'DOMNode', 'ownerDocument' => 'DOMDocument')
The properties of a DOMNode can do a lot of damage to debuggers. The DOMNode contains not one, not two, not three, not four, not 5, not 6, not 7 but 8 different ways to recurse into itself:
- firstChild
- lastChild
- previousSibling
- nextSibling
- ownerDocument
- parentNode
- childNodes
- attributes
All of this combined: the tiny SVGs used as the caret in Kint are already enough to make parsing and rendering take over a second, and send memory usage over 128 megs. So we blacklist every field we don't strictly need and hope that that's good enough.
In retrospect - this is probably why print_r does the same
$verbose
Show all properties and methods.
public
static bool
$verbose
= false
$parser
protected
mixed
$parser
Methods
getTriggers()
public
getTriggers() : mixed
Return values
mixed —getTypes()
An array of types (As returned by gettype) for all data this plugin can operate on.
public
getTypes() : array<string|int, mixed>
Return values
array<string|int, mixed> —List of types
parse()
public
parse(mixed &$var, BasicObject &$o, mixed $trigger) : mixed
Parameters
- $var : mixed
- $o : BasicObject
- $trigger : mixed
Return values
mixed —setParser()
public
setParser(Parser $p) : mixed
Parameters
- $p : Parser
Return values
mixed —parseList()
protected
parseList(mixed &$var, InstanceObject &$o, mixed $trigger) : mixed
Parameters
- $var : mixed
- $o : InstanceObject
- $trigger : mixed
Return values
mixed —parseNode()
protected
parseNode(mixed &$var, InstanceObject &$o) : mixed
Parameters
- $var : mixed
- $o : InstanceObject
Return values
mixed —parseProperty()
protected
parseProperty(InstanceObject $o, mixed $prop, mixed &$var) : mixed
Parameters
- $o : InstanceObject
- $prop : mixed
- $var : mixed
Return values
mixed —textualNodeToString()
protected
static textualNodeToString(InstanceObject $o) : mixed
Parameters
- $o : InstanceObject