Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 9 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
LangConverter | |
0.00% |
0 / 9 |
|
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 1 |
run | |
0.00% |
0 / 9 |
|
0.00% |
0 / 1 |
6 |
1 | <?php |
2 | declare( strict_types = 1 ); |
3 | |
4 | namespace Wikimedia\Parsoid\Wt2Html\DOM\Processors; |
5 | |
6 | use Wikimedia\Assert\Assert; |
7 | use Wikimedia\Parsoid\Config\Env; |
8 | use Wikimedia\Parsoid\DOM\Node; |
9 | use Wikimedia\Parsoid\Language\LanguageConverter; |
10 | use Wikimedia\Parsoid\Wt2Html\Wt2HtmlDOMProcessor; |
11 | |
12 | class LangConverter implements Wt2HtmlDOMProcessor { |
13 | /** |
14 | * @inheritDoc |
15 | */ |
16 | public function run( |
17 | Env $env, Node $root, array $options = [], bool $atTopLevel = false |
18 | ): void { |
19 | Assert::invariant( $atTopLevel, 'This pass should only be run on the top-level' ); |
20 | if ( $env->getSkipLanguageConversionPass() ) { |
21 | return; |
22 | } |
23 | LanguageConverter::maybeConvert( |
24 | $env, |
25 | $root->ownerDocument, |
26 | $env->getHtmlVariantLanguageBcp47(), |
27 | $env->getWtVariantLanguageBcp47() |
28 | ); |
29 | } |
30 | } |