Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 9 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| LanguageVariantText | |
0.00% |
0 / 9 |
|
0.00% |
0 / 2 |
12 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 6 |
|
0.00% |
0 / 1 |
2 | |||
| fromSelSerImpl | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
6 | |||
| 1 | <?php |
| 2 | declare( strict_types = 1 ); |
| 3 | |
| 4 | namespace Wikimedia\Parsoid\Html2Wt\ConstrainedText; |
| 5 | |
| 6 | use Wikimedia\Parsoid\Config\Env; |
| 7 | use Wikimedia\Parsoid\DOM\Element; |
| 8 | use Wikimedia\Parsoid\NodeData\DataParsoid; |
| 9 | use Wikimedia\Parsoid\Utils\DOMUtils; |
| 10 | |
| 11 | /** |
| 12 | * Language Variant markup, like `-{ ... }-`. |
| 13 | */ |
| 14 | class LanguageVariantText extends RegExpConstrainedText { |
| 15 | |
| 16 | public function __construct( string $text, Element $node ) { |
| 17 | parent::__construct( [ |
| 18 | 'text' => $text, |
| 19 | 'node' => $node, |
| 20 | // at sol vertical bars immediately preceding cause problems in tables |
| 21 | 'badPrefix' => /* RegExp */ '/^\|$/D' |
| 22 | ] |
| 23 | ); |
| 24 | } |
| 25 | |
| 26 | protected static function fromSelSerImpl( |
| 27 | string $text, Element $node, DataParsoid $dataParsoid, |
| 28 | Env $env, array $opts |
| 29 | ): ?LanguageVariantText { |
| 30 | if ( DOMUtils::hasTypeOf( $node, 'mw:LanguageVariant' ) ) { |
| 31 | return new LanguageVariantText( $text, $node ); |
| 32 | } |
| 33 | return null; |
| 34 | } |
| 35 | } |