Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
ContentTextTransformStage
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 transform
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
1
 transformText
n/a
0 / 0
n/a
0 / 0
0
1<?php
2
3namespace MediaWiki\OutputTransform;
4
5use MediaWiki\Parser\ParserOutput;
6use ParserOptions;
7
8/**
9 * OutputTransformStages that only modify the content. It is expected that all inheriting classes call this class'
10 * transform() method (either directly by inheritance or by calling them in the overloaded method).
11 * @internal
12 */
13abstract class ContentTextTransformStage implements OutputTransformStage {
14
15    public function transform( ParserOutput $po, ?ParserOptions $popts, array &$options ): ParserOutput {
16        $text = $po->getContentHolderText();
17        $text = $this->transformText( $text, $po, $popts, $options );
18        $po->setContentHolderText( $text );
19        return $po;
20    }
21
22    abstract protected function transformText(
23        string $text, ParserOutput $po, ?ParserOptions $popts, array &$options
24    ): string;
25}