24use Wikimedia\Assert\Assert;
25use Wikimedia\Assert\ParameterTypeException;
90 throw new ParameterTypeException(
'$namespace',
'int' );
92 if ( !is_string(
$title ) ) {
93 throw new ParameterTypeException(
'$title',
'string' );
96 throw new ParameterTypeException(
'$fragment',
'string' );
99 throw new ParameterTypeException(
'$interwiki',
'string' );
103 Assert::parameter( !preg_match(
'/^[_ ]|[\r\n\t]|[_ ]$/',
$title ),
'$title',
104 "invalid name '$title'" );
109 'should not be empty unless namespace is main and fragment or interwiki is non-empty'
113 $this->dbkey = strtr(
$title,
' ',
'_' );
132 return $this->
namespace == $ns;
148 return $this->fragment !==
'';
175 return str_replace(
'_',
' ', $this->dbkey );
202 return $this->interwiki !==
'';
224 $name = $this->
namespace . ':' . $this->dbkey;
226 if ( $this->fragment !== '' ) {
227 $name .=
'#' . $this->fragment;
230 if ( $this->interwiki !==
'' ) {
231 $name = $this->interwiki .
':' . $name;
if(ini_get('mbstring.func_overload')) if(!defined('MW_ENTRY_POINT'))
Pre-config setup: Before loading LocalSettings.php.
Represents a page (or page fragment) title within MediaWiki.
isExternal()
Whether it has an interwiki part.
__construct( $namespace, $title, $fragment='', $interwiki='')
Constructs a TitleValue.
getInterwiki()
Returns the interwiki part.
string $prefixedText
Text form including namespace/interwiki, initialised on demand.
getText()
Returns the title in text form, without namespace prefix or fragment.
createFragmentTarget( $fragment)
Creates a new TitleValue for a different fragment of the same page.
getDBkey()
Returns the title's DB key, as supplied to the constructor, without namespace prefix or fragment.
__toString()
Returns a string representation of the title, for logging.