MediaWiki master
OutputTransformPipeline.php
Go to the documentation of this file.
1<?php
2
4
7
12
14 private array $stages = [];
15
17 $this->stages[] = $stage;
18 return $this;
19 }
20
61 public function run( ParserOutput $in, ?ParserOptions $popts, array $options ): ParserOutput {
62 if ( $options['suppressClone'] ?? false ) {
63 // T353257: This should be a clone, but we've need to suppress it
64 // for some legacy codepaths.
65 $out = $in;
66 } else {
67 $out = clone $in;
68 }
69 foreach ( $this->stages as $stage ) {
70 if ( $stage->shouldRun( $out, $popts, $options ) ) {
71 // Some stages may (for now) modify $options. See OutputTransformStage documentation for more info.
72 $out = $stage->transform( $out, $popts, $options );
73 }
74 }
75 return $out;
76 }
77}
if(!defined('MW_SETUP_CALLBACK'))
Definition WebStart.php:81
run(ParserOutput $in, ?ParserOptions $popts, array $options)
Runs the pipeline on the ParserOutput, yielding a transformed ParserOutput.
ParserOutput is a rendering of a Content object or a message.
Set options of the Parser.
Classes implementing the OutputTransformStage aim at being added to a pipeline of transformations tha...