Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 9 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
NlTk | |
0.00% |
0 / 9 |
|
0.00% |
0 / 2 |
20 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
12 | |||
jsonSerialize | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | declare( strict_types = 1 ); |
3 | |
4 | namespace Wikimedia\Parsoid\Tokens; |
5 | |
6 | use Wikimedia\Parsoid\NodeData\DataParsoid; |
7 | |
8 | /** |
9 | * Newline token. |
10 | */ |
11 | class NlTk extends Token { |
12 | /** |
13 | * @param ?SourceRange $tsr |
14 | * TSR ("tag source range") represents the (start, end) wikitext |
15 | * byte offsets for a token (in this case, the newline) in the |
16 | * UTF8-encoded source string |
17 | * @param ?DataParsoid $dataParsoid |
18 | */ |
19 | public function __construct( |
20 | ?SourceRange $tsr, ?DataParsoid $dataParsoid = null |
21 | ) { |
22 | if ( $dataParsoid ) { |
23 | $this->dataParsoid = $dataParsoid; |
24 | } elseif ( $tsr ) { |
25 | $this->dataParsoid = new DataParsoid; |
26 | $this->dataParsoid->tsr = $tsr; |
27 | } |
28 | } |
29 | |
30 | /** |
31 | * @inheritDoc |
32 | */ |
33 | public function jsonSerialize(): array { |
34 | return [ |
35 | 'type' => $this->getType(), |
36 | 'dataParsoid' => $this->dataParsoid |
37 | ]; |
38 | } |
39 | } |