MediaWiki master
UploadStashException.php
Go to the documentation of this file.
1<?php
8
12use RuntimeException;
13use Throwable;
15
20class UploadStashException extends RuntimeException implements ILocalizedException {
22 protected $messageSpec;
23
30 public function __construct( $messageSpec, $code = 0, ?Throwable $previous = null ) {
31 $this->messageSpec = $messageSpec;
32
33 $msg = $this->getMessageObject()->text();
34 $msg = preg_replace( '!</?(var|kbd|samp|code)>!', '"', $msg );
35 $msg = Sanitizer::stripAllTags( $msg );
36 parent::__construct( $msg, $code, $previous );
37 }
38
40 public function getMessageObject() {
41 return Message::newFromSpecifier( $this->messageSpec );
42 }
43}
The Message class deals with fetching and processing of interface message into a variety of formats.
Definition Message.php:144
static newFromSpecifier( $value)
Transform a MessageSpecifier or a primitive value used interchangeably with specifiers (a message key...
Definition Message.php:492
HTML sanitizer for MediaWiki.
Definition Sanitizer.php:32
__construct( $messageSpec, $code=0, ?Throwable $previous=null)
getMessageObject()
Return a Message object for this exception.Message
Interface for MediaWiki-localized exceptions.