Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
15 / 15 |
|
100.00% |
12 / 12 |
CRAP | |
100.00% |
1 / 1 |
RelayTreeHandler | |
100.00% |
15 / 15 |
|
100.00% |
12 / 12 |
12 | |
100.00% |
1 / 1 |
__construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
startDocument | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
endDocument | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
characters | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
insertElement | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
endTag | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
doctype | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
comment | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
error | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
mergeAttributes | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
removeNode | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
reparentChildren | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | |
3 | namespace Wikimedia\RemexHtml\TreeBuilder; |
4 | |
5 | use Wikimedia\RemexHtml\Tokenizer\Attributes; |
6 | |
7 | /** |
8 | * A TreeHandler which simply passes all events through to another handler. |
9 | * |
10 | * Applications can subclass this in order to modify only a few event types |
11 | * as they pass through. |
12 | * |
13 | * @since 2.1.0 |
14 | */ |
15 | class RelayTreeHandler implements TreeHandler { |
16 | /** @var TreeHandler */ |
17 | protected $nextHandler; |
18 | |
19 | /** |
20 | * Construct a RelayTreeHandler which will call $nextHandler on all events |
21 | * |
22 | * @param TreeHandler $nextHandler |
23 | */ |
24 | public function __construct( TreeHandler $nextHandler ) { |
25 | $this->nextHandler = $nextHandler; |
26 | } |
27 | |
28 | /** |
29 | * @inheritDoc |
30 | */ |
31 | public function startDocument( $fragmentNamespace, $fragmentName ) { |
32 | $this->nextHandler->startDocument( $fragmentNamespace, $fragmentName ); |
33 | } |
34 | |
35 | /** |
36 | * @inheritDoc |
37 | */ |
38 | public function endDocument( $pos ) { |
39 | $this->nextHandler->endDocument( $pos ); |
40 | } |
41 | |
42 | /** |
43 | * @inheritDoc |
44 | */ |
45 | public function characters( |
46 | $preposition, $ref, $text, $start, $length, $sourceStart, $sourceLength |
47 | ) { |
48 | $this->nextHandler->characters( $preposition, $ref, $text, $start, $length, |
49 | $sourceStart, $sourceLength ); |
50 | } |
51 | |
52 | /** |
53 | * @inheritDoc |
54 | */ |
55 | public function insertElement( $preposition, $ref, Element $element, $void, |
56 | $sourceStart, $sourceLength |
57 | ) { |
58 | $this->nextHandler->insertElement( $preposition, $ref, $element, $void, |
59 | $sourceStart, $sourceLength ); |
60 | } |
61 | |
62 | /** |
63 | * @inheritDoc |
64 | */ |
65 | public function endTag( Element $element, $sourceStart, $sourceLength ) { |
66 | $this->nextHandler->endTag( $element, $sourceStart, $sourceLength ); |
67 | } |
68 | |
69 | /** |
70 | * @inheritDoc |
71 | */ |
72 | public function doctype( $name, $public, $system, $quirks, $sourceStart, $sourceLength ) { |
73 | $this->nextHandler->doctype( $name, $public, $system, $quirks, |
74 | $sourceStart, $sourceLength ); |
75 | } |
76 | |
77 | /** |
78 | * @inheritDoc |
79 | */ |
80 | public function comment( $preposition, $ref, $text, $sourceStart, $sourceLength ) { |
81 | $this->nextHandler->comment( $preposition, $ref, $text, $sourceStart, $sourceLength ); |
82 | } |
83 | |
84 | /** |
85 | * @inheritDoc |
86 | */ |
87 | public function error( $text, $pos ) { |
88 | $this->nextHandler->error( $text, $pos ); |
89 | } |
90 | |
91 | /** |
92 | * @inheritDoc |
93 | */ |
94 | public function mergeAttributes( Element $element, Attributes $attrs, $sourceStart ) { |
95 | $this->nextHandler->mergeAttributes( $element, $attrs, $sourceStart ); |
96 | } |
97 | |
98 | /** |
99 | * @inheritDoc |
100 | */ |
101 | public function removeNode( Element $element, $sourceStart ) { |
102 | $this->nextHandler->removeNode( $element, $sourceStart ); |
103 | } |
104 | |
105 | /** |
106 | * @inheritDoc |
107 | */ |
108 | public function reparentChildren( Element $element, Element $newParent, $sourceStart ) { |
109 | $this->nextHandler->reparentChildren( $element, $newParent, $sourceStart ); |
110 | } |
111 | } |