MediaWiki master
FallbackContent.php
Go to the documentation of this file.
1<?php
7namespace MediaWiki\Content;
8
22
27 public function __construct(
28 private readonly string $data,
29 string $model_id,
30 ) {
31 parent::__construct( $model_id );
32 }
33
35 public function copy() {
36 // FallbackContent is immutable, so no need to copy.
37 return $this;
38 }
39
47 public function getTextForSummary( $maxlength = 250 ) {
48 return '';
49 }
50
56 public function getSize() {
57 return strlen( $this->data );
58 }
59
68 public function isCountable( $hasLinks = null ) {
69 return false;
70 }
71
75 public function getNativeData() {
76 wfDeprecated( __METHOD__, '1.33' );
77 return $this->getData();
78 }
79
83 public function getData() {
84 return $this->data;
85 }
86
92 public function serialize( $format = null ) {
93 return $this->getData();
94 }
95
101 public function getTextForSearchIndex() {
102 return '';
103 }
104
108 public function getWikitextForTransclusion() {
109 return false;
110 }
111
117 public function convert( $toModel, $lossy = '' ) {
118 return false;
119 }
120
122 protected function equalsInternal( Content $that ) {
123 if ( !$that instanceof FallbackContent ) {
124 return false;
125 }
126
127 return $this->getData() == $that->getData();
128 }
129
130}
132class_alias( FallbackContent::class, 'FallbackContent' );
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Logs a warning that a deprecated feature was used.
Base class for all Content objects.
Content object implementation representing unknown content.
__construct(private readonly string $data, string $model_id,)
getTextForSearchIndex()
Returns an empty string.
isCountable( $hasLinks=null)
Returns false.
equalsInternal(Content $that)
Helper for AbstractContent::equals.Do not call this method directly, call Content::equals() instead....
getSize()
Returns the data size in bytes.
getTextForSummary( $maxlength=250)
Returns an empty string.
copy()
Create a copy of this Content object.The following must be true for the returned object,...
Content objects represent page content, e.g.
Definition Content.php:28