Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 6 |
|
0.00% |
0 / 6 |
CRAP | |
0.00% |
0 / 1 |
ExtensionTag | |
0.00% |
0 / 6 |
|
0.00% |
0 / 6 |
42 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getName | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getOffsets | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getSource | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
isSelfClosed | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getDefaultDataMw | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | declare( strict_types = 1 ); |
3 | |
4 | namespace Wikimedia\Parsoid\Ext; |
5 | |
6 | use Wikimedia\Parsoid\Core\DomSourceRange; |
7 | use Wikimedia\Parsoid\NodeData\DataMw; |
8 | use Wikimedia\Parsoid\Tokens\Token; |
9 | use Wikimedia\Parsoid\Utils\Utils; |
10 | |
11 | /** |
12 | * Wrapper so that the internal token isn't exposed |
13 | */ |
14 | class ExtensionTag { |
15 | |
16 | /** @var Token */ |
17 | private $extToken; |
18 | |
19 | public function __construct( Token $extToken ) { |
20 | $this->extToken = $extToken; |
21 | } |
22 | |
23 | /** |
24 | * Return the name of the extension tag |
25 | */ |
26 | public function getName(): string { |
27 | return $this->extToken->getAttributeV( 'name' ); |
28 | } |
29 | |
30 | /** |
31 | * Return the source offsets for this extension tag usage |
32 | */ |
33 | public function getOffsets(): ?DomSourceRange { |
34 | return $this->extToken->dataParsoid->extTagOffsets ?? null; |
35 | } |
36 | |
37 | /** |
38 | * Return the full extension source |
39 | */ |
40 | public function getSource(): ?string { |
41 | return $this->extToken->getAttributeV( 'source' ); |
42 | } |
43 | |
44 | /** |
45 | * Is this extension tag self-closed? |
46 | */ |
47 | public function isSelfClosed(): bool { |
48 | return !empty( $this->extToken->dataParsoid->selfClose ); |
49 | } |
50 | |
51 | public function getDefaultDataMw(): DataMw { |
52 | return Utils::getExtArgInfo( $this->extToken ); |
53 | } |
54 | } |