Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 8 |
NlTk | |
0.00% |
0 / 1 |
|
0.00% |
0 / 2 |
42 | |
0.00% |
0 / 8 |
__construct | |
0.00% |
0 / 1 |
30 | |
0.00% |
0 / 6 |
|||
jsonSerialize | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 2 |
<?php | |
declare( strict_types = 1 ); | |
namespace Wikimedia\Parsoid\Tokens; | |
use Wikimedia\Parsoid\NodeData\DataParsoid; | |
/** | |
* Newline token. | |
*/ | |
class NlTk extends Token { | |
/** | |
* @param ?SourceRange $tsr | |
* TSR ("tag source range") represents the (start, end) wikitext | |
* byte offsets for a token (in this case, the newline) in the | |
* UTF8-encoded source string | |
* @param ?DataParsoid $dataAttribs | |
*/ | |
public function __construct( | |
?SourceRange $tsr, ?DataParsoid $dataAttribs = null | |
) { | |
if ( $dataAttribs ) { | |
$this->dataAttribs = $dataAttribs; | |
} elseif ( $tsr ) { | |
$this->dataAttribs = new DataParsoid; | |
$this->dataAttribs->tsr = $tsr; | |
} | |
} | |
/** | |
* @inheritDoc | |
*/ | |
public function jsonSerialize(): array { | |
return [ | |
'type' => $this->getType(), | |
'dataAttribs' => $this->dataAttribs | |
]; | |
} | |
} |