MediaWiki
master
Toggle main menu visibility
MalformedTitleException.php
Go to the documentation of this file.
1
<?php
6
7
namespace
MediaWiki\Title;
8
9
use
Exception
;
10
use MediaWiki\Exception\ILocalizedException;
11
use MediaWiki\Message\Message;
12
18
class
MalformedTitleException
extends
Exception
implements
ILocalizedException
{
19
21
private
$titleText;
23
private
$errorMessage;
25
private
$errorMessageParameters;
26
34
public
function
__construct
(
35
$errorMessage, $titleText =
null
, $errorMessageParameters = []
36
) {
37
$this->errorMessage = $errorMessage;
38
$this->titleText = $titleText;
39
if
( $titleText !==
null
) {
40
$errorMessageParameters[] =
wfEscapeWikiText
( $titleText );
41
}
42
$this->errorMessageParameters = $errorMessageParameters;
43
44
// Supply something useful for Exception::getMessage() to return.
45
$enMsg =
wfMessage
( $errorMessage, $errorMessageParameters );
46
$enMsg->inLanguage(
'en'
)->useDatabase(
false
);
47
parent::__construct( $enMsg->text() );
48
}
49
54
public
function
getTitleText
() {
55
return
$this->titleText;
56
}
57
62
public
function
getErrorMessage
() {
63
return
$this->errorMessage;
64
}
65
70
public
function
getErrorMessageParameters
() {
71
return
$this->errorMessageParameters;
72
}
73
78
public
function
getMessageObject
() {
79
return
wfMessage
( $this->
getErrorMessage
(), $this->
getErrorMessageParameters
() );
80
}
81
}
82
84
class_alias( MalformedTitleException::class,
'MalformedTitleException'
);
wfEscapeWikiText
wfEscapeWikiText( $input)
Escapes the given text so that it may be output using addWikiText() without any linking,...
Definition
GlobalFunctions.php:784
wfMessage
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
Definition
GlobalFunctions.php:548
MediaWiki\Title\MalformedTitleException
MalformedTitleException is thrown when a TitleParser is unable to parse a title string.
Definition
MalformedTitleException.php:18
MediaWiki\Title\MalformedTitleException\getErrorMessage
getErrorMessage()
Definition
MalformedTitleException.php:62
MediaWiki\Title\MalformedTitleException\getTitleText
getTitleText()
Definition
MalformedTitleException.php:54
MediaWiki\Title\MalformedTitleException\getErrorMessageParameters
getErrorMessageParameters()
Definition
MalformedTitleException.php:70
MediaWiki\Title\MalformedTitleException\getMessageObject
getMessageObject()
Definition
MalformedTitleException.php:78
MediaWiki\Title\MalformedTitleException\__construct
__construct( $errorMessage, $titleText=null, $errorMessageParameters=[])
Definition
MalformedTitleException.php:34
MediaWiki\Exception\ILocalizedException
Interface for MediaWiki-localized exceptions.
Definition
ILocalizedException.php:19
MediaWiki\Exception
Definition
BadRequestError.php:7
includes
Title
MalformedTitleException.php
Generated on
for MediaWiki by
1.18.0