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
4// @phan-file-suppress PhanEmptyPublicMethod
5
6namespace Wikimedia\Parsoid\Ext;
7
8use Wikimedia\Parsoid\DOM\DocumentFragment;
9use Wikimedia\Parsoid\DOM\Element;
10
11/**
12 * A Parsoid extension module may contain one or more DOMProcessors,
13 * which allow Parsoid to post-process the DOM in the wt2html direction,
14 * or pre-process the DOM in the html2wt direction.
15 */
16abstract class DOMProcessor {
17
18    /**
19     * Post-process DOM in the wt2html direction.
20     *
21     * @param ParsoidExtensionAPI $extApi
22     * @param DocumentFragment|Element $root The root of the tree to process
23     * @param array $options
24     */
25    public function wtPostprocess(
26        ParsoidExtensionAPI $extApi,
27        DocumentFragment|Element $root,
28        array $options
29    ): void {
30        /* do nothing by default */
31    }
32
33    /**
34     * Pre-process DOM in the html2wt direction.
35     *
36     * @param ParsoidExtensionAPI $extApi
37     * @param Element $root
38     */
39    public function htmlPreprocess(
40        ParsoidExtensionAPI $extApi,
41        Element $root
42    ): void {
43        /* do nothing by default */
44    }
45}