Parsoid
A bidirectional parser between wikitext and HTML5
Loading...
Searching...
No Matches
Wikimedia\Parsoid\Utils\TitleValue Class Reference

Lightweight title class. More...

+ Inheritance diagram for Wikimedia\Parsoid\Utils\TitleValue:
+ Collaboration diagram for Wikimedia\Parsoid\Utils\TitleValue:

Public Member Functions

 getNamespace ()
 Get the namespace index.
Returns
int Namespace index

 
 getFragment ()
 Get the link fragment in text form (i.e.the bit after the hash #).
Returns
string link fragment

 
 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.
Returns
string

 
 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.
Parameters
string$fragmentThe fragment override, or "" to remove it.
Returns
LinkTarget

 
 getInterwiki ()
 The interwiki component of this LinkTarget.
Returns
string

 
- Public Member Functions inherited from Wikimedia\Parsoid\Core\LinkTarget
 inNamespace (int $ns)
 Convenience function to check if the target is in a given namespace.
 
 hasFragment ()
 Whether the link target has a fragment.
 
 getText ()
 Get the main part of the link target, in text form.
 
 isExternal ()
 Whether this LinkTarget has an interwiki component.
 
 isSameLinkAs (LinkTarget $other)
 Check whether the given LinkTarget refers to the same target as this LinkTarget.
 
 __toString ()
 Return an informative human-readable representation of the link target, for use in logging and debugging.
 

Static Public Member Functions

static tryNew (int $namespace, string $title, string $fragment='', string $interwiki='')
 Constructs a TitleValue, or returns null if the parameters are not valid.
 

Detailed Description

Lightweight title class.

Member Function Documentation

◆ createFragmentTarget()

Wikimedia\Parsoid\Utils\TitleValue::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.

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

Implements Wikimedia\Parsoid\Core\LinkTarget.

◆ getDBkey()

Wikimedia\Parsoid\Utils\TitleValue::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.

Returns
string

Implements Wikimedia\Parsoid\Core\LinkTarget.

◆ getFragment()

Wikimedia\Parsoid\Utils\TitleValue::getFragment ( )

Get the link fragment in text form (i.e.the bit after the hash #).

Returns
string link fragment

Implements Wikimedia\Parsoid\Core\LinkTarget.

◆ getInterwiki()

Wikimedia\Parsoid\Utils\TitleValue::getInterwiki ( )

The interwiki component of this LinkTarget.

Returns
string

Implements Wikimedia\Parsoid\Core\LinkTarget.

◆ getNamespace()

Wikimedia\Parsoid\Utils\TitleValue::getNamespace ( )

Get the namespace index.

Returns
int Namespace index

Implements Wikimedia\Parsoid\Core\LinkTarget.

◆ tryNew()

static Wikimedia\Parsoid\Utils\TitleValue::tryNew ( int $namespace,
string $title,
string $fragment = '',
string $interwiki = '' )
static

Constructs a TitleValue, or returns null if the parameters are not valid.

Note
This does not perform any normalization, and only basic validation.
Parameters
int$namespaceThe namespace ID. This is not validated.
string$titleThe page title in either DBkey or text form. No normalization is applied beyond underscore/space conversion.
string$fragmentThe fragment title. Use '' to represent the whole page. No validation or normalization is applied.
string$interwikiThe interwiki component. No validation or normalization is applied.
Returns
TitleValue|null

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