Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 9
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
LangConverter
0.00% covered (danger)
0.00%
0 / 9
0.00% covered (danger)
0.00%
0 / 1
6
0.00% covered (danger)
0.00%
0 / 1
 run
0.00% covered (danger)
0.00%
0 / 9
0.00% covered (danger)
0.00%
0 / 1
6
1<?php
2declare( strict_types = 1 );
3
4namespace Wikimedia\Parsoid\Wt2Html\DOM\Processors;
5
6use Wikimedia\Assert\Assert;
7use Wikimedia\Parsoid\Config\Env;
8use Wikimedia\Parsoid\DOM\Node;
9use Wikimedia\Parsoid\Language\LanguageConverter;
10use Wikimedia\Parsoid\Wt2Html\Wt2HtmlDOMProcessor;
11
12class 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}