X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Ftitle%2FMalformedTitleException.php;h=2dddac5c2c8962ddf603a2854ea82b9db7b687f4;hb=bcbf750b8b8ba0eb16056200e0cc88c81d4bb2eb;hp=0892ce4e5713273823829cfd90a202d8ced306ae;hpb=9771b003756bfe3825bf7427efca6393ed96597b;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/title/MalformedTitleException.php b/includes/title/MalformedTitleException.php index 0892ce4e57..2dddac5c2c 100644 --- a/includes/title/MalformedTitleException.php +++ b/includes/title/MalformedTitleException.php @@ -22,10 +22,10 @@ * 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) @@ -33,7 +33,9 @@ class MalformedTitleException extends Exception { * @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 ) { @@ -70,4 +72,12 @@ class MalformedTitleException extends Exception { public function getErrorMessageParameters() { return $this->errorMessageParameters; } + + /** + * @since 1.29 + * @return Message + */ + public function getMessageObject() { + return wfMessage( $this->getErrorMessage(), $this->getErrorMessageParameters() ); + } }