MediaWiki master
FallbackContent.php
Go to the documentation of this file.
1<?php
28namespace MediaWiki\Content;
29
31use Content;
32
44
46 private $data;
47
52 public function __construct( $data, $model_id ) {
53 parent::__construct( $model_id );
54
55 $this->data = $data;
56 }
57
61 public function copy() {
62 // FallbackContent is immutable, so no need to copy.
63 return $this;
64 }
65
73 public function getTextForSummary( $maxlength = 250 ) {
74 return '';
75 }
76
82 public function getSize() {
83 return strlen( $this->data );
84 }
85
94 public function isCountable( $hasLinks = null ) {
95 return false;
96 }
97
101 public function getNativeData() {
102 return $this->getData();
103 }
104
108 public function getData() {
109 return $this->data;
110 }
111
117 public function serialize( $format = null ) {
118 return $this->getData();
119 }
120
126 public function getTextForSearchIndex() {
127 return '';
128 }
129
133 public function getWikitextForTransclusion() {
134 return false;
135 }
136
142 public function convert( $toModel, $lossy = '' ) {
143 return false;
144 }
145
146 protected function equalsInternal( Content $that ) {
147 if ( !$that instanceof FallbackContent ) {
148 return false;
149 }
150
151 return $this->getData() == $that->getData();
152 }
153
154}
156class_alias( FallbackContent::class, 'FallbackContent' );
Base implementation for content objects.
string $model_id
Name of the content model this Content object represents.
Content object implementation representing unknown content.
getTextForSearchIndex()
Returns an empty string.
isCountable( $hasLinks=null)
Returns false.
equalsInternal(Content $that)
Checks whether $that is logically equal to this Content object.
getSize()
Returns the data size in bytes.
getTextForSummary( $maxlength=250)
Returns an empty string.
Base interface for representing page content.
Definition Content.php:37