Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
DOMProcessor
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 2
6
0.00% covered (danger)
0.00%
0 / 1
 wtPostprocess
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 htmlPreprocess
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2declare( strict_types = 1 );
3
4namespace Wikimedia\Parsoid\Ext;
5
6use Wikimedia\Parsoid\DOM\DocumentFragment;
7use Wikimedia\Parsoid\DOM\Element;
8use Wikimedia\Parsoid\DOM\Node;
9
10/**
11 * A Parsoid extension module may contain one or more DOMProcessors,
12 * which allow Parsoid to post-process the DOM in the wt2html direction,
13 * or pre-process the DOM in the html2wt direction.
14 *
15 * @phan-file-suppress PhanEmptyPublicMethod
16 */
17abstract class DOMProcessor {
18
19    /**
20     * Post-process DOM in the wt2html direction.
21     *
22     * @param ParsoidExtensionAPI $extApi
23     * @param DocumentFragment|Element $root The root of the tree to process
24     * @param array $options
25     */
26    public function wtPostprocess(
27        ParsoidExtensionAPI $extApi,
28        Node $root,
29        array $options
30    ): void {
31        /* do nothing by default */
32    }
33
34    /**
35     * Pre-process DOM in the html2wt direction.
36     *
37     * @param ParsoidExtensionAPI $extApi
38     * @param Element $root
39     */
40    public function htmlPreprocess(
41        ParsoidExtensionAPI $extApi,
42        Element $root
43    ): void {
44        /* do nothing by default */
45    }
46}