Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
3 / 3 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| MediaWikiWikitextParser | |
100.00% |
3 / 3 |
|
100.00% |
2 / 2 |
3 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| parse | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace Kartographer; |
| 4 | |
| 5 | use MediaWiki\Parser\Parser; |
| 6 | use MediaWiki\Parser\PPFrame; |
| 7 | |
| 8 | /** |
| 9 | * @license MIT |
| 10 | */ |
| 11 | class MediaWikiWikitextParser extends WikitextParser { |
| 12 | |
| 13 | public function __construct( |
| 14 | private readonly Parser $parser, |
| 15 | private readonly ?PPFrame $frame = null, |
| 16 | ) { |
| 17 | } |
| 18 | |
| 19 | /** @inheritDoc */ |
| 20 | protected function parse( string $wikiText ): string { |
| 21 | $wikiText = $this->parser->recursiveTagParseFully( $wikiText, $this->frame ?: false ); |
| 22 | return trim( Parser::stripOuterParagraph( $wikiText ) ); |
| 23 | } |
| 24 | |
| 25 | } |