25use Wikimedia\Assert\Assert;
75 Assert::parameterType(
'integer',
$namespace,
'$namespace' );
76 Assert::parameterType(
'string',
$dbkey,
'$dbkey' );
77 Assert::parameterType(
'string',
$fragment,
'$fragment' );
78 Assert::parameterType(
'string',
$interwiki,
'$interwiki' );
81 Assert::parameter( !preg_match(
'/^_|[ \r\n\t]|_$/',
$dbkey ),
'$dbkey',
82 "invalid DB key '$dbkey'" );
83 Assert::parameter(
$dbkey !==
'',
'$dbkey',
'should not be empty' );
104 return $this->
namespace == $ns;
119 return $this->fragment !==
'';
144 return str_replace(
'_',
' ', $this->
getDBkey() );
171 return $this->interwiki !==
'';
192 $name = $this->
namespace . ':' . $this->dbkey;
194 if ( $this->fragment !== '' ) {
195 $name .=
'#' . $this->fragment;
198 if ( $this->interwiki !==
'' ) {
199 $name = $this->interwiki .
':' .
$name;
Represents a page (or page fragment) title within MediaWiki.
isExternal()
Whether it has an interwiki part.
__construct( $namespace, $dbkey, $fragment='', $interwiki='')
Constructs a TitleValue.
getInterwiki()
Returns the interwiki part.
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.
Allows to change the fields on the form that will be generated $name