| 1 |
<?php |
| 2 |
|
| 3 |
use MediaWiki\Content\Content; |
| 4 |
use MediaWiki\Content\Renderer\ContentParseParams; |
| 5 |
use MediaWiki\Parser\ParserOutput; |
| 6 |
|
| 7 |
class DummyNonTextContentHandler extends DummyContentHandlerForTesting { |
| 8 |
|
| 9 |
public function __construct( $dataModel ) { |
| 10 |
parent::__construct( $dataModel, [ "testing-nontext" ] ); |
| 11 |
} |
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
public function serializeContent( Content $content, $format = null ) { |
| 22 |
return $content->serialize(); |
| 23 |
} |
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
public function unserializeContent( $blob, $format = null ) { |
| 34 |
return new DummyNonTextContent( $blob ); |
| 35 |
} |
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
public function makeEmptyContent() { |
| 42 |
return new DummyNonTextContent( '' ); |
| 43 |
} |
| 44 |
|
| 45 |
public function supportsDirectApiEditing() { |
| 46 |
return true; |
| 47 |
} |
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
protected function fillParserOutput( |
| 58 |
Content $content, |
| 59 |
ContentParseParams $cpoParams, |
| 60 |
ParserOutput &$output |
| 61 |
) { |
| 62 |
'@phan-var DummyNonTextContent $content'; |
| 63 |
$output = new ParserOutput( $content->serialize() ); |
| 64 |
} |
| 65 |
} |