* MalformedTitleException is thrown when a TitleParser is unable to parse a title string.
* @since 1.23
*/
-class MalformedTitleException extends Exception {
+class MalformedTitleException extends Exception implements ILocalizedException {
private $titleText = null;
private $errorMessage = null;
- private $errorMessageParameters = array();
+ private $errorMessageParameters = [];
/**
* @param string $errorMessage Localisation message describing the error (since MW 1.26)
* @param string[] $errorMessageParameters Additional parameters for the error message.
* $titleText will be appended if it's not null. (since MW 1.26)
*/
- public function __construct( $errorMessage = null, $titleText = null, $errorMessageParameters = array() ) {
+ public function __construct(
+ $errorMessage = null, $titleText = null, $errorMessageParameters = []
+ ) {
$this->errorMessage = $errorMessage;
$this->titleText = $titleText;
if ( $titleText !== null ) {
public function getErrorMessageParameters() {
return $this->errorMessageParameters;
}
+
+ /**
+ * @since 1.29
+ * @return Message
+ */
+ public function getMessageObject() {
+ return wfMessage( $this->getErrorMessage(), $this->getErrorMessageParameters() );
+ }
}