MediaWiki REL1_39
MalformedTitleException.php
Go to the documentation of this file.
1<?php
26class MalformedTitleException extends Exception implements ILocalizedException {
27
29 private $titleText;
31 private $errorMessage;
33 private $errorMessageParameters;
34
42 public function __construct(
43 $errorMessage, $titleText = null, $errorMessageParameters = []
44 ) {
45 $this->errorMessage = $errorMessage;
46 $this->titleText = $titleText;
47 if ( $titleText !== null ) {
48 $errorMessageParameters[] = wfEscapeWikiText( $titleText );
49 }
50 $this->errorMessageParameters = $errorMessageParameters;
51
52 // Supply something useful for Exception::getMessage() to return.
53 $enMsg = wfMessage( $errorMessage, $errorMessageParameters );
54 $enMsg->inLanguage( 'en' )->useDatabase( false );
55 parent::__construct( $enMsg->text() );
56 }
57
62 public function getTitleText() {
63 return $this->titleText;
64 }
65
70 public function getErrorMessage() {
71 return $this->errorMessage;
72 }
73
78 public function getErrorMessageParameters() {
79 return $this->errorMessageParameters;
80 }
81
86 public function getMessageObject() {
87 return wfMessage( $this->getErrorMessage(), $this->getErrorMessageParameters() );
88 }
89}
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
wfEscapeWikiText( $text)
Escapes the given text so that it may be output using addWikiText() without any linking,...
MalformedTitleException is thrown when a TitleParser is unable to parse a title string.
__construct( $errorMessage, $titleText=null, $errorMessageParameters=[])
Interface for MediaWiki-localized exceptions.