Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
WrapAnnotations
0.00% covered (danger)
0.00%
0 / 3
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 / 3
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\Parsoid\Config\Env;
7use Wikimedia\Parsoid\DOM\Node;
8use Wikimedia\Parsoid\Wt2Html\Wt2HtmlDOMProcessor;
9
10class WrapAnnotations implements Wt2HtmlDOMProcessor {
11
12    /**
13     * Encapsulate template-affected DOM structures by wrapping text nodes into
14     * spans and adding RDFa attributes to all subtree roots according to
15     * http://www.mediawiki.org/wiki/Parsoid/RDFa_vocabulary#Template_content
16     * @inheritDoc
17     */
18    public function run(
19        Env $env, Node $root, array $options = [], bool $atTopLevel = false
20    ): void {
21        if ( $env->hasAnnotations ) {
22            $op = new AnnotationDOMRangeBuilder( $root->ownerDocument, $options['frame'] );
23            $op->execute( $root );
24        }
25    }
26}