MediaWiki master
MediaWiki\Content\FallbackContent Class Reference

Content object implementation representing unknown content. More...

Inherits MediaWiki\Content\AbstractContent.

Collaboration diagram for MediaWiki\Content\FallbackContent:

Public Member Functions

 __construct ( $data, $model_id)
 
 convert ( $toModel, $lossy='')
 
 copy ()
 
 getData ()
 
 getNativeData ()
 
 getSize ()
 Returns the data size in bytes.
 
 getTextForSearchIndex ()
 Returns an empty string.
 
 getTextForSummary ( $maxlength=250)
 Returns an empty string.
 
 getWikitextForTransclusion ()
 
 isCountable ( $hasLinks=null)
 Returns false.
 
 serialize ( $format=null)
 
- Public Member Functions inherited from MediaWiki\Content\AbstractContent
 __construct ( $modelId=null)
 
 addSectionHeader ( $header)
 
 equals (?Content $that=null)
 
 getContentHandler ()
 
 getDefaultFormat ()
 
 getModel ()
 
 getRedirectTarget ()
 Subclasses that implement redirects should override this.
 
 getSection ( $sectionId)
 
 getSupportedFormats ()
 
 isEmpty ()
 
 isRedirect ()
 
 isSupportedFormat ( $format)
 
 isValid ()
 
 matchMagicWord (MagicWord $word)
 This default implementation always returns false.
 
 replaceSection ( $sectionId, Content $with, $sectionTitle='')
 
 updateRedirect (Title $target)
 This default implementation always returns $this.
 

Protected Member Functions

 equalsInternal (Content $that)
 Helper for AbstractContent::equals.
 
- Protected Member Functions inherited from MediaWiki\Content\AbstractContent
 checkFormat ( $format)
 Helper for subclasses.
 
 checkModelID ( $modelId)
 Helper for subclasses.
 
 getContentHandlerFactory ()
 

Additional Inherited Members

- Protected Attributes inherited from MediaWiki\Content\AbstractContent
string $model_id
 

Detailed Description

Content object implementation representing unknown content.

This can be used to handle content for which no ContentHandler exists on the system, perhaps because the extension that provided it has been removed.

FallbackContent instances are immutable.

Since
1.36 (As UnknownContent in 1.34)
Author
Daniel Kinzler

Definition at line 35 of file FallbackContent.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Content\FallbackContent::__construct ( $data,
$model_id )
Parameters
string$data
string$model_idThe model ID to handle

Definition at line 44 of file FallbackContent.php.

References MediaWiki\Content\AbstractContent\$model_id.

Member Function Documentation

◆ convert()

MediaWiki\Content\FallbackContent::convert ( $toModel,
$lossy = '' )
Parameters
string$toModel
string$lossy
Returns
false

Reimplemented from MediaWiki\Content\AbstractContent.

Definition at line 134 of file FallbackContent.php.

◆ copy()

MediaWiki\Content\FallbackContent::copy ( )
Returns
Content $this

Implements MediaWiki\Content\Content.

Definition at line 53 of file FallbackContent.php.

◆ equalsInternal()

MediaWiki\Content\FallbackContent::equalsInternal ( Content $that)
protected

Helper for AbstractContent::equals.

Note
Do not call this method directly, call Content::equals() instead.

This method can be overwritten by subclasses that only need to implement custom equality checks, with the rest of the Content::equals contract taken care of by AbstractContent::equals.

This default implementation compares Content::serialize of each object.

If you override this method, you can safely assume that $that is an instance of the same class as the current Content object. This is ensured by AbstractContent::equals.

See also
Content::equals
Stability: stable
to override
Parameters
Content$that
Returns
bool

Reimplemented from MediaWiki\Content\AbstractContent.

Definition at line 138 of file FallbackContent.php.

References MediaWiki\Content\FallbackContent\getData().

◆ getData()

MediaWiki\Content\FallbackContent::getData ( )

◆ getNativeData()

MediaWiki\Content\FallbackContent::getNativeData ( )
Returns
string data of unknown format and meaning

Reimplemented from MediaWiki\Content\AbstractContent.

Definition at line 93 of file FallbackContent.php.

References MediaWiki\Content\FallbackContent\getData().

◆ getSize()

MediaWiki\Content\FallbackContent::getSize ( )

Returns the data size in bytes.

Returns
int

Implements MediaWiki\Content\Content.

Definition at line 74 of file FallbackContent.php.

◆ getTextForSearchIndex()

MediaWiki\Content\FallbackContent::getTextForSearchIndex ( )

Returns an empty string.

Returns
string The raw text.

Implements MediaWiki\Content\Content.

Definition at line 118 of file FallbackContent.php.

◆ getTextForSummary()

MediaWiki\Content\FallbackContent::getTextForSummary ( $maxlength = 250)

Returns an empty string.

Parameters
int$maxlength
Returns
string

Implements MediaWiki\Content\Content.

Definition at line 65 of file FallbackContent.php.

◆ getWikitextForTransclusion()

MediaWiki\Content\FallbackContent::getWikitextForTransclusion ( )
Returns
false

Implements MediaWiki\Content\Content.

Definition at line 125 of file FallbackContent.php.

◆ isCountable()

MediaWiki\Content\FallbackContent::isCountable ( $hasLinks = null)

Returns false.

Parameters
bool | null$hasLinksIf it is known whether this content contains links, provide this information here, to avoid redundant parsing to find out.
Returns
bool

Implements MediaWiki\Content\Content.

Definition at line 86 of file FallbackContent.php.

◆ serialize()

MediaWiki\Content\FallbackContent::serialize ( $format = null)
Parameters
string | null$format
Returns
string data of unknown format and meaning

Reimplemented from MediaWiki\Content\AbstractContent.

Definition at line 109 of file FallbackContent.php.

References MediaWiki\Content\FallbackContent\getData().


The documentation for this class was generated from the following file: