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 getData() {
76 return $this->data;
77 }
78
84 public function serialize( $format = null ) {
85 return $this->getData();
86 }
87
93 public function getTextForSearchIndex() {
94 return '';
95 }
96
100 public function getWikitextForTransclusion() {
101 return false;
102 }
103
109 public function convert( $toModel, $lossy = '' ) {
110 return false;
111 }
112
114 protected function equalsInternal( Content $that ) {
115 if ( !$that instanceof FallbackContent ) {
116 return false;
117 }
118
119 return $this->getData() == $that->getData();
120 }
121
122}
124class_alias( FallbackContent::class, 'FallbackContent' );
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