Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 12
0.00% covered (danger)
0.00%
0 / 12
CRAP
0.00% covered (danger)
0.00%
0 / 1
DestructTracer
0.00% covered (danger)
0.00%
0 / 12
0.00% covered (danger)
0.00%
0 / 12
156
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 startDocument
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 endDocument
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 characters
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 insertElement
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 endTag
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 doctype
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 comment
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 error
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 mergeAttributes
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 removeNode
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 reparentChildren
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3namespace Wikimedia\RemexHtml\TreeBuilder;
4
5use Wikimedia\RemexHtml\Tokenizer\Attributes;
6
7/**
8 * A debugging helper which calls a callback function with a descriptive message
9 * each time an Element node is destroyed.
10 */
11class DestructTracer implements TreeHandler {
12    private $callback;
13
14    public function __construct( $callback ) {
15        $this->callback = $callback;
16    }
17
18    public function startDocument( $fragmentNamespace, $fragmentName ) {
19    }
20
21    public function endDocument( $pos ) {
22    }
23
24    public function characters( $preposition, $ref, $text, $start, $length,
25        $sourceStart, $sourceLength
26    ) {
27    }
28
29    public function insertElement( $preposition, $ref, Element $element, $void,
30        $sourceStart, $sourceLength
31    ) {
32        $element->userData = new DestructTracerNode( $this->callback, $element->getDebugTag() );
33    }
34
35    public function endTag( Element $element, $sourceStart, $sourceLength ) {
36    }
37
38    public function doctype( $name, $public, $system, $quirks, $sourceStart, $sourceLength ) {
39    }
40
41    public function comment( $preposition, $ref, $text, $sourceStart, $sourceLength ) {
42    }
43
44    public function error( $text, $pos ) {
45    }
46
47    public function mergeAttributes( Element $element, Attributes $attrs, $sourceStart ) {
48    }
49
50    public function removeNode( Element $element, $sourceStart ) {
51    }
52
53    public function reparentChildren( Element $element, Element $newParent, $sourceStart ) {
54        $newParent->userData = new DestructTracerNode( $this->callback, $newParent->getDebugTag() );
55    }
56}