3 use MediaWiki\Content\Content
;
4 use MediaWiki\Content\Renderer\ContentParseParams
;
5 use MediaWiki\Parser\ParserOutput
;
7 class DummyNonTextContentHandler
extends DummyContentHandlerForTesting
{
9 public function __construct( $dataModel ) {
10 parent
::__construct( $dataModel, [ "testing-nontext" ] );
14 * @see ContentHandler::serializeContent
16 * @param Content $content
17 * @param string|null $format
21 public function serializeContent( Content
$content, $format = null ) {
22 return $content->serialize();
26 * @see ContentHandler::unserializeContent
29 * @param string|null $format Unused.
33 public function unserializeContent( $blob, $format = null ) {
34 return new DummyNonTextContent( $blob );
38 * Creates an empty Content object of the type supported by this ContentHandler.
39 * @return DummyNonTextContent
41 public function makeEmptyContent() {
42 return new DummyNonTextContent( '' );
45 public function supportsDirectApiEditing() {
50 * @see ContentHandler::fillParserOutput()
53 * @param Content $content
54 * @param ContentParseParams $cpoParams
55 * @param ParserOutput &$output The output object to fill (reference).
57 protected function fillParserOutput(
59 ContentParseParams
$cpoParams,
62 '@phan-var DummyNonTextContent $content';
63 $output = new ParserOutput( $content->serialize() );