Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
87.50% |
7 / 8 |
|
75.00% |
3 / 4 |
CRAP | |
0.00% |
0 / 1 |
Text | |
87.50% |
7 / 8 |
|
75.00% |
3 / 4 |
4.03 | |
0.00% |
0 / 1 |
characters | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
endDocument | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
startTag | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
endTag | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | |
3 | namespace Wikimedia\RemexHtml\TreeBuilder; |
4 | |
5 | use Wikimedia\RemexHtml\Tokenizer\Attributes; |
6 | |
7 | /** |
8 | * The "text" insertion mode |
9 | */ |
10 | class Text extends InsertionMode { |
11 | public function characters( $text, $start, $length, $sourceStart, $sourceLength ) { |
12 | $this->builder->insertCharacters( $text, $start, $length, $sourceStart, $sourceLength ); |
13 | } |
14 | |
15 | public function endDocument( $pos ) { |
16 | $this->builder->error( 'unexpected end of input in text mode', $pos ); |
17 | $this->builder->pop( $pos, 0 ); |
18 | $this->dispatcher->restoreMode() |
19 | ->endDocument( $pos ); |
20 | } |
21 | |
22 | public function startTag( $name, Attributes $attrs, $selfClose, $sourceStart, $sourceLength ) { |
23 | // @phan-suppress-previous-line PhanPluginNeverReturnMethod |
24 | throw new TreeBuilderError( 'unexpected token' ); |
25 | } |
26 | |
27 | public function endTag( $name, $sourceStart, $sourceLength ) { |
28 | // I think this is complete if we have no support for executing scripts |
29 | $this->builder->pop( $sourceStart, $sourceLength ); |
30 | $this->dispatcher->restoreMode(); |
31 | } |
32 | } |