Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 13 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
Mechanism | |
0.00% |
0 / 13 |
|
0.00% |
0 / 2 |
30 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
parse | |
0.00% |
0 / 12 |
|
0.00% |
0 / 1 |
20 |
1 | <?php |
2 | |
3 | namespace MediaWiki\Extension\ParserMigration; |
4 | |
5 | use MediaWiki\Content\Content; |
6 | use MediaWiki\MediaWikiServices; |
7 | use MediaWiki\Parser\ParserOptions; |
8 | use MediaWiki\Title\Title; |
9 | use MediaWiki\User\User; |
10 | |
11 | class Mechanism { |
12 | |
13 | /** |
14 | */ |
15 | public function __construct() { |
16 | } |
17 | |
18 | /** |
19 | * @param Content $content |
20 | * @param Title $title |
21 | * @param ParserOptions $baseOptions |
22 | * @param User $user |
23 | * @param array $configIndexes |
24 | * @return array |
25 | */ |
26 | public function parse( Content $content, Title $title, |
27 | ParserOptions $baseOptions, User $user, array $configIndexes |
28 | ) { |
29 | $contentRenderer = MediaWikiServices::getInstance()->getContentRenderer(); |
30 | if ( $baseOptions->getUseParsoid() ) { |
31 | $parsoid = $baseOptions; |
32 | $legacy = clone $baseOptions; |
33 | $legacy->setOption( 'useParsoid', false ); |
34 | } else { |
35 | $legacy = $baseOptions; |
36 | $parsoid = clone $baseOptions; |
37 | $parsoid->setUseParsoid(); |
38 | } |
39 | |
40 | $outputs = []; |
41 | foreach ( $configIndexes as $i ) { |
42 | $outputs[$i] = $contentRenderer->getParserOutput( $content, $title, null, $i ? $parsoid : $legacy ); |
43 | } |
44 | return $outputs; |
45 | } |
46 | } |