MediaWiki master
FallbackContent.php
Go to the documentation of this file.
1<?php
21namespace MediaWiki\Content;
22
36
38 private $data;
39
44 public function __construct( $data, $model_id ) {
45 parent::__construct( $model_id );
46
47 $this->data = $data;
48 }
49
53 public function copy() {
54 // FallbackContent is immutable, so no need to copy.
55 return $this;
56 }
57
65 public function getTextForSummary( $maxlength = 250 ) {
66 return '';
67 }
68
74 public function getSize() {
75 return strlen( $this->data );
76 }
77
86 public function isCountable( $hasLinks = null ) {
87 return false;
88 }
89
93 public function getNativeData() {
94 return $this->getData();
95 }
96
100 public function getData() {
101 return $this->data;
102 }
103
109 public function serialize( $format = null ) {
110 return $this->getData();
111 }
112
118 public function getTextForSearchIndex() {
119 return '';
120 }
121
125 public function getWikitextForTransclusion() {
126 return false;
127 }
128
134 public function convert( $toModel, $lossy = '' ) {
135 return false;
136 }
137
138 protected function equalsInternal( Content $that ) {
139 if ( !$that instanceof FallbackContent ) {
140 return false;
141 }
142
143 return $this->getData() == $that->getData();
144 }
145
146}
148class_alias( FallbackContent::class, 'FallbackContent' );
Base class for all Content objects.
Content object implementation representing unknown content.
getTextForSearchIndex()
Returns an empty string.
isCountable( $hasLinks=null)
Returns false.
equalsInternal(Content $that)
Helper for AbstractContent::equals.
getSize()
Returns the data size in bytes.
getTextForSummary( $maxlength=250)
Returns an empty string.
Content objects represent page content, e.g.
Definition Content.php:42