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