MediaWiki REL1_39
MediaWiki\Linker\LinkTarget Interface Reference
Inheritance diagram for MediaWiki\Linker\LinkTarget:

Public Member Functions

 __toString ()
 Return an informative human-readable representation of the link target, for use in logging and debugging.
 
 createFragmentTarget (string $fragment)
 Create a new LinkTarget with a different fragment on the same page.
 
 getDBkey ()
 Get the main part of the link target, in canonical database form.
 
 getFragment ()
 Get the link fragment in text form (i.e.
 
 getInterwiki ()
 The interwiki component of this LinkTarget.
 
 getNamespace ()
 Get the namespace index.
 
 getText ()
 Get the main part of the link target, in text form.
 
 hasFragment ()
 Whether the link target has a fragment.
 
 inNamespace (int $ns)
 Convenience function to check if the target is in a given namespace.
 
 isExternal ()
 Whether this LinkTarget has an interwiki component.
 
 isSameLinkAs (LinkTarget $other)
 Check whether the given LinkTarget refers to the same target as this LinkTarget.
 

Detailed Description

Since
1.27

Definition at line 26 of file LinkTarget.php.

Member Function Documentation

◆ __toString()

MediaWiki\Linker\LinkTarget::__toString ( )

Return an informative human-readable representation of the link target, for use in logging and debugging.

Returns
string

Implemented in Title, and TitleValue.

◆ createFragmentTarget()

MediaWiki\Linker\LinkTarget::createFragmentTarget ( string $fragment)

Create a new LinkTarget with a different fragment on the same page.

It is expected that the same type of object will be returned, but the only requirement is that it is a LinkTarget.

Since
1.27
Parameters
string$fragmentThe fragment override, or "" to remove it.
Returns
LinkTarget

Implemented in Title, and TitleValue.

◆ getDBkey()

MediaWiki\Linker\LinkTarget::getDBkey ( )

Get the main part of the link target, in canonical database form.

The main part is the link target without namespace prefix or hash fragment. The database form means that spaces become underscores, this is also used for URLs.

Since
1.27
Returns
string

Implemented in Title, and TitleValue.

Referenced by Parser\fetchFileAndTitle(), WikiPage\insertRedirectEntry(), LanguageConverter\updateConversionTable(), and MessageCache\updateMessageOverride().

◆ getFragment()

MediaWiki\Linker\LinkTarget::getFragment ( )

Get the link fragment in text form (i.e.

the bit after the hash #).

Since
1.27
Returns
string link fragment

Implemented in Title, and TitleValue.

Referenced by WikiPage\insertRedirectEntry(), and Title\newFromLinkTarget().

◆ getInterwiki()

MediaWiki\Linker\LinkTarget::getInterwiki ( )

The interwiki component of this LinkTarget.

Since
1.27
Returns
string

Implemented in Title, and TitleValue.

Referenced by NamespaceInfo\canHaveTalkPage(), WikiPage\insertRedirectEntry(), and Title\newFromLinkTarget().

◆ getNamespace()

MediaWiki\Linker\LinkTarget::getNamespace ( )

Get the namespace index.

Since
1.27
Returns
int Namespace index

Implemented in Title, and TitleValue.

Referenced by NamespaceInfo\canHaveTalkPage(), WikiPage\insertRedirectEntry(), Title\newFromLinkTarget(), and LanguageConverter\updateConversionTable().

◆ getText()

MediaWiki\Linker\LinkTarget::getText ( )

Get the main part of the link target, in text form.

The main part is the link target without namespace prefix or hash fragment. The text form is used for display purposes.

This is computed from the DB key by replacing any underscores with spaces.

Note
To get a title string that includes the namespace and/or fragment, use a TitleFormatter.
Since
1.27
Returns
string

Implemented in Title, and TitleValue.

Referenced by NamespaceInfo\canHaveTalkPage(), Parser\makeImage(), and Title\newFromLinkTarget().

◆ hasFragment()

MediaWiki\Linker\LinkTarget::hasFragment ( )

Whether the link target has a fragment.

Since
1.27
Returns
bool

Implemented in Title, and TitleValue.

◆ inNamespace()

MediaWiki\Linker\LinkTarget::inNamespace ( int $ns)

Convenience function to check if the target is in a given namespace.

Since
1.27
Parameters
int$ns
Returns
bool

Implemented in Title, and TitleValue.

◆ isExternal()

MediaWiki\Linker\LinkTarget::isExternal ( )

Whether this LinkTarget has an interwiki component.

Since
1.27
Returns
bool

Implemented in Title, and TitleValue.

Referenced by LinkBatch\addObj().

◆ isSameLinkAs()

MediaWiki\Linker\LinkTarget::isSameLinkAs ( LinkTarget $other)

Check whether the given LinkTarget refers to the same target as this LinkTarget.

Two link targets are considered the same if they have the same interwiki prefix, are in the same namespace, have the same main part, and the same fragment.

Since
1.36
Parameters
LinkTarget$other
Returns
bool

Implemented in Title, and TitleValue.

Referenced by Parser\fetchFileAndTitle().


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