3 use MediaWiki\Content\AbstractContent
;
4 use MediaWiki\Content\Content
;
6 class DummyContentForTesting
extends AbstractContent
{
8 public const MODEL_ID
= "testing";
13 public function __construct( $data ) {
14 parent
::__construct( self
::MODEL_ID
);
19 public function serialize( $format = null ) {
24 * @return string A string representing the content in a way useful for
25 * building a full text search index. If no useful representation exists,
26 * this method returns an empty string.
28 public function getTextForSearchIndex() {
33 * @return string|bool The wikitext to include when another page includes this content,
34 * or false if the content is not includable in a wikitext page.
36 public function getWikitextForTransclusion() {
41 * Returns a textual representation of the content suitable for use in edit
42 * summaries and log messages.
44 * @param int $maxlength Maximum length of the summary text.
45 * @return string The summary text.
47 public function getTextForSummary( $maxlength = 250 ) {
52 * Returns native representation of the data. Interpretation depends on the data model used,
53 * as given by getDataModel().
55 * @return mixed The native representation of the content. Could be a string, a nested array
56 * structure, an object, a binary blob... anything, really.
58 public function getNativeData() {
63 * returns the content's nominal size in bogo-bytes.
67 public function getSize() {
68 return strlen( $this->data
);
72 * Return a copy of this Content object. The following must be true for the object returned
73 * if $copy = $original->copy()
75 * * get_class($original) === get_class($copy)
76 * * $original->getModel() === $copy->getModel()
77 * * $original->equals( $copy )
79 * If and only if the Content object is immutable, the copy() method can and should
80 * return $this. That is, $copy === $original may be true, but only for imutable content
83 * @return Content A copy of this object
85 public function copy() {
90 * Returns true if this content is countable as a "real" wiki page, provided
91 * that it's also in a countable location (e.g. a current revision in the main namespace).
93 * @param bool|null $hasLinks If it is known whether this content contains links,
94 * provide this information here, to avoid redundant parsing to find out.
97 public function isCountable( $hasLinks = null ) {