Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
10 / 10 |
|
100.00% |
9 / 9 |
CRAP | |
100.00% |
1 / 1 |
RelayTokenHandler | |
100.00% |
10 / 10 |
|
100.00% |
9 / 9 |
9 | |
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 | |||
error | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
characters | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
startTag | |
100.00% |
1 / 1 |
|
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 |
1 | <?php |
2 | |
3 | namespace Wikimedia\RemexHtml\Tokenizer; |
4 | |
5 | /** |
6 | * A TokenHandler which simply passes all tokens through to another token |
7 | * handler, specified in the constructor. |
8 | * |
9 | * Applications can subclass this in order to modify only a few token types |
10 | * as they pass through. |
11 | * |
12 | * @since 2.1.0 |
13 | */ |
14 | class RelayTokenHandler implements TokenHandler { |
15 | /** @var TokenHandler */ |
16 | protected $nextHandler; |
17 | |
18 | /** |
19 | * Construct a RelayTokenHandler which will call $nextHandler on all events |
20 | * |
21 | * @param TokenHandler $nextHandler |
22 | */ |
23 | public function __construct( TokenHandler $nextHandler ) { |
24 | $this->nextHandler = $nextHandler; |
25 | } |
26 | |
27 | /** |
28 | * @inheritDoc |
29 | */ |
30 | public function startDocument( Tokenizer $tokenizer, $fragmentNamespace, $fragmentName ) { |
31 | $this->nextHandler->startDocument( $tokenizer, $fragmentNamespace, $fragmentName ); |
32 | } |
33 | |
34 | /** |
35 | * @inheritDoc |
36 | */ |
37 | public function endDocument( $pos ) { |
38 | $this->nextHandler->endDocument( $pos ); |
39 | } |
40 | |
41 | /** |
42 | * @inheritDoc |
43 | */ |
44 | public function error( $text, $pos ) { |
45 | $this->nextHandler->error( $text, $pos ); |
46 | } |
47 | |
48 | /** |
49 | * @inheritDoc |
50 | */ |
51 | public function characters( $text, $start, $length, $sourceStart, $sourceLength ) { |
52 | $this->nextHandler->characters( $text, $start, $length, $sourceStart, $sourceLength ); |
53 | } |
54 | |
55 | /** |
56 | * @inheritDoc |
57 | */ |
58 | public function startTag( $name, Attributes $attrs, $selfClose, $sourceStart, $sourceLength ) { |
59 | $this->nextHandler->startTag( $name, $attrs, $selfClose, $sourceLength, $sourceLength ); |
60 | } |
61 | |
62 | /** |
63 | * @inheritDoc |
64 | */ |
65 | public function endTag( $name, $sourceStart, $sourceLength ) { |
66 | $this->nextHandler->endTag( $name, $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, $sourceStart, |
74 | $sourceLength ); |
75 | } |
76 | |
77 | /** |
78 | * @inheritDoc |
79 | */ |
80 | public function comment( $text, $sourceStart, $sourceLength ) { |
81 | $this->nextHandler->comment( $text, $sourceStart, $sourceLength ); |
82 | } |
83 | } |