3 class DummyContentForTesting
extends AbstractContent
{
5 const MODEL_ID
= "testing";
7 public function __construct( $data ) {
8 parent
::__construct( self
::MODEL_ID
);
13 public function serialize( $format = null ) {
14 return serialize( $this->data
);
18 * @return string A string representing the content in a way useful for
19 * building a full text search index. If no useful representation exists,
20 * this method returns an empty string.
22 public function getTextForSearchIndex() {
27 * @return string|bool The wikitext to include when another page includes this content,
28 * or false if the content is not includable in a wikitext page.
30 public function getWikitextForTransclusion() {
35 * Returns a textual representation of the content suitable for use in edit
36 * summaries and log messages.
38 * @param int $maxlength Maximum length of the summary text.
39 * @return string The summary text.
41 public function getTextForSummary( $maxlength = 250 ) {
46 * Returns native represenation of the data. Interpretation depends on the data model used,
47 * as given by getDataModel().
49 * @return mixed The native representation of the content. Could be a string, a nested array
50 * structure, an object, a binary blob... anything, really.
52 public function getNativeData() {
57 * returns the content's nominal size in bogo-bytes.
61 public function getSize() {
62 return strlen( $this->data
);
66 * Return a copy of this Content object. The following must be true for the object returned
67 * if $copy = $original->copy()
69 * * get_class($original) === get_class($copy)
70 * * $original->getModel() === $copy->getModel()
71 * * $original->equals( $copy )
73 * If and only if the Content object is imutable, the copy() method can and should
74 * return $this. That is, $copy === $original may be true, but only for imutable content
77 * @return Content A copy of this object
79 public function copy() {
84 * Returns true if this content is countable as a "real" wiki page, provided
85 * that it's also in a countable location (e.g. a current revision in the main namespace).
87 * @param bool|null $hasLinks If it is known whether this content contains links,
88 * provide this information here, to avoid redundant parsing to find out.
91 public function isCountable( $hasLinks = null ) {
97 * @param int $revId Unused.
98 * @param null|ParserOptions $options
99 * @param bool $generateHtml Whether to generate Html (default: true). If false, the result
100 * of calling getText() on the ParserOutput object returned by this method is undefined.
102 * @return ParserOutput
104 public function getParserOutput( Title
$title, $revId = null,
105 ParserOptions
$options = null, $generateHtml = true
107 return new ParserOutput( $this->getNativeData() );
111 * @see AbstractContent::fillParserOutput()
113 * @param Title $title Context title for parsing
114 * @param int|null $revId Revision ID (for {{REVISIONID}})
115 * @param ParserOptions $options Parser options
116 * @param bool $generateHtml Whether or not to generate HTML
117 * @param ParserOutput &$output The output object to fill (reference).
119 protected function fillParserOutput( Title
$title, $revId,
120 ParserOptions
$options, $generateHtml, ParserOutput
&$output ) {
121 $output = new ParserOutput( $this->getNativeData() );