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
2declare( strict_types = 1 );
3
4namespace MediaWiki\OutputTransform;
5
6use MediaWiki\Parser\ParserOptions;
7use MediaWiki\Parser\ParserOutput;
8
9/**
10 * OutputTransformStages that only modify the content. It is expected that all inheriting classes call this class'
11 * transform() method (either directly by inheritance or by calling them in the overloaded method).
12 * @internal
13 */
14abstract class ContentTextTransformStage extends OutputTransformStage {
15
16    public function transform( ParserOutput $po, ParserOptions $popts, array &$options ): ParserOutput {
17        $text = $po->getContentHolderText();
18        $text = $this->transformText( $text, $po, $popts, $options );
19        $po->setContentHolderText( $text );
20        return $po;
21    }
22
23    abstract protected function transformText(
24        string $text, ParserOutput $po, ParserOptions $popts, array &$options
25    ): string;
26}