MediaWiki master
MediaWiki\Title\TitleParser Interface Reference

A title parser service for MediaWiki. More...

Inherited by MediaWiki\Title\MediaWikiTitleCodec.

Public Member Functions

 makeTitleValueSafe ( $namespace, $text, $fragment='', $interwiki='')
 Given a namespace and title, return a TitleValue if valid, or null if invalid.
 
 parseTitle ( $text, $defaultNamespace=NS_MAIN)
 Parses the given text and constructs a TitleValue.
 

Detailed Description

A title parser service for MediaWiki.

This is designed to encapsulate knowledge about conventions for the title forms to be used in the database, in urls, in wikitext, etc.

See also
https://www.mediawiki.org/wiki/Requests_for_comment/TitleValue
Since
1.23

Definition at line 35 of file TitleParser.php.

Member Function Documentation

◆ makeTitleValueSafe()

MediaWiki\Title\TitleParser::makeTitleValueSafe ( $namespace,
$text,
$fragment = '',
$interwiki = '' )

Given a namespace and title, return a TitleValue if valid, or null if invalid.

Parameters
int$namespace
string$text
string$fragment
string$interwiki
Returns
TitleValue|null

Implemented in MediaWiki\Title\MediaWikiTitleCodec.

◆ parseTitle()

MediaWiki\Title\TitleParser::parseTitle ( $text,
$defaultNamespace = NS_MAIN )

Parses the given text and constructs a TitleValue.

Note
this only parses local page links, interwiki-prefixes etc. are not considered!
Parameters
string$textThe text to parse
int$defaultNamespaceNamespace to assume per default (usually NS_MAIN)
Exceptions
MalformedTitleExceptionIf the text is not a valid representation of a page title.
Returns
TitleValue

Implemented in MediaWiki\Title\MediaWikiTitleCodec.


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