Localisation updates from https://translatewiki.net.
[mediawiki.git] / tests / phpunit / mocks / content / DummyNonTextContent.php
blob12c4ca5faf51c1fa6facefe39f538f06d36d8e19
1 <?php
3 use MediaWiki\Content\AbstractContent;
4 use MediaWiki\Content\Content;
6 class DummyNonTextContent extends AbstractContent {
8 /** @var mixed */
9 private $data;
11 public function __construct( $data ) {
12 parent::__construct( "testing-nontext" );
14 $this->data = $data;
17 public function serialize( $format = null ) {
18 return $this->data;
21 /**
22 * @return string A string representing the content in a way useful for
23 * building a full text search index. If no useful representation exists,
24 * this method returns an empty string.
26 public function getTextForSearchIndex() {
27 return '';
30 /**
31 * @return string|bool The wikitext to include when another page includes this content,
32 * or false if the content is not includable in a wikitext page.
34 public function getWikitextForTransclusion() {
35 return false;
38 /**
39 * Returns a textual representation of the content suitable for use in edit
40 * summaries and log messages.
42 * @param int $maxlength Maximum length of the summary text.
43 * @return string The summary text.
45 public function getTextForSummary( $maxlength = 250 ) {
46 return '';
49 /**
50 * Returns native representation of the data. Interpretation depends on the data model used,
51 * as given by getDataModel().
53 * @return mixed The native representation of the content. Could be a string, a nested array
54 * structure, an object, a binary blob... anything, really.
56 public function getNativeData() {
57 return $this->data;
60 /**
61 * returns the content's nominal size in bogo-bytes.
63 * @return int
65 public function getSize() {
66 return strlen( $this->data );
69 /**
70 * Return a copy of this Content object. The following must be true for the object returned
71 * if $copy = $original->copy()
73 * * get_class($original) === get_class($copy)
74 * * $original->getModel() === $copy->getModel()
75 * * $original->equals( $copy )
77 * If and only if the Content object is immutable, the copy() method can and should
78 * return $this. That is, $copy === $original may be true, but only for imutable content
79 * objects.
81 * @return Content A copy of this object
83 public function copy() {
84 return $this;
87 /**
88 * Returns true if this content is countable as a "real" wiki page, provided
89 * that it's also in a countable location (e.g. a current revision in the main namespace).
91 * @param bool|null $hasLinks If it is known whether this content contains links,
92 * provide this information here, to avoid redundant parsing to find out.
93 * @return bool
95 public function isCountable( $hasLinks = null ) {
96 return false;