* @param string|Message $msg A message key (default: 'badtitletext')
* @param array $params parameter to wfMessage()
*/
- function __construct( $msg = 'badtitletext', $params = array() ) {
+ public function __construct( $msg = 'badtitletext', $params = array() ) {
parent::__construct( 'badtitle', $msg, $params );
}
* Just like ErrorPageError::report() but additionally set
* a 400 HTTP status code (bug 33646).
*/
- function report() {
+ public function report() {
global $wgOut;
// bug 33646: a badtitle error page need to return an error code
* @param string|Message $msg Message key (string) for error text, or a Message object
* @param array $params with parameters to wfMessage()
*/
- function __construct( $title, $msg, $params = array() ) {
+ public function __construct( $title, $msg, $params = array() ) {
$this->title = $title;
$this->msg = $msg;
$this->params = $params;
parent::__construct( $enMsg->text() );
}
- function report() {
+ public function report() {
global $wgOut;
$wgOut->showErrorPage( $this->title, $this->msg, $this->params );
/**
* @return string
*/
- function getHTML() {
+ public function getHTML() {
return $this->getMessage();
}
/**
* @return string
*/
- function getText() {
+ public function getText() {
return $this->getMessage();
}
}
*
* @return bool
*/
- function useOutputPage() {
+ public function useOutputPage() {
return $this->useMessageCache() &&
!empty( $GLOBALS['wgFullyInitialised'] ) &&
!empty( $GLOBALS['wgOut'] ) &&
* @since 1.23
* @return boolean
*/
- function isLoggable() {
+ public function isLoggable() {
return true;
}
*
* @return bool
*/
- function useMessageCache() {
+ public function useMessageCache() {
global $wgLang;
foreach ( $this->getTrace() as $frame ) {
* @param array $args arguments to pass to the callback functions
* @return string|null string to output or null if any hook has been called
*/
- function runHooks( $name, $args = array() ) {
+ public function runHooks( $name, $args = array() ) {
global $wgExceptionHooks;
if ( !isset( $wgExceptionHooks ) || !is_array( $wgExceptionHooks ) ) {
* The function also has other parameters that are arguments for the message
* @return string message with arguments replaced
*/
- function msg( $key, $fallback /*[, params...] */ ) {
+ public function msg( $key, $fallback /*[, params...] */ ) {
$args = array_slice( func_get_args(), 2 );
if ( $this->useMessageCache() ) {
*
* @return string html to output
*/
- function getHTML() {
+ public function getHTML() {
global $wgShowExceptionDetails;
if ( $wgShowExceptionDetails ) {
*
* @return string
*/
- function getText() {
+ public function getText() {
global $wgShowExceptionDetails;
if ( $wgShowExceptionDetails ) {
*
* @return string
*/
- function getPageTitle() {
+ public function getPageTitle() {
global $wgSitename;
return $this->msg( 'pagetitle', "$1 - $wgSitename", $this->msg( 'internalerror', 'Internal error' ) );
}
* @deprecated since 1.22 Use MWExceptionHandler::getLogId instead.
* @return string
*/
- function getLogId() {
+ public function getLogId() {
wfDeprecated( __METHOD__, '1.22' );
return MWExceptionHandler::getLogId( $this );
}
* @deprecated since 1.22 Use MWExceptionHandler::getLogMessage instead.
* @return string
*/
- function getLogMessage() {
+ public function getLogMessage() {
wfDeprecated( __METHOD__, '1.22' );
return MWExceptionHandler::getLogMessage( $this );
}
/**
* Output the exception report using HTML.
*/
- function reportHTML() {
+ public function reportHTML() {
global $wgOut;
if ( $this->useOutputPage() ) {
$wgOut->prepareErrorPage( $this->getPageTitle() );
* Output a report about the exception and takes care of formatting.
* It will be either HTML or plain text based on isCommandLine().
*/
- function report() {
+ public function report() {
global $wgMimeType;
MWExceptionHandler::logException( $this );
*
* @return bool
*/
- static function isCommandLine() {
+ public static function isCommandLine() {
return !empty( $GLOBALS['wgCommandLineMode'] );
}
}
class PermissionsError extends ErrorPageError {
public $permission, $errors;
- function __construct( $permission, $errors = array() ) {
+ public function __construct( $permission, $errors = array() ) {
global $wgLang;
$this->permission = $permission;
$this->errors = $errors;
}
- function report() {
+ public function report() {
global $wgOut;
$wgOut->showPermissionsErrorPage( $this->errors, $this->permission );
/**
* @covers MWExceptionHandler::getRedactedTrace
*/
- function testGetRedactedTrace() {
+ public function testGetRedactedTrace() {
$refvar = 'value';
try {
$array = array( 'a', 'b' );
/**
* @expectedException MWException
*/
- function testMwexceptionThrowing() {
+ public function testMwexceptionThrowing() {
throw new MWException();
}
* @covers MWExceptionHandler::jsonSerializeException
* @dataProvider provideExceptionClasses
*/
- function testJsonSerializeExceptions( $exception_class ) {
+ public function testJsonSerializeExceptions( $exception_class ) {
$json = MWExceptionHandler::jsonSerializeException(
new $exception_class()
);
"The $exception_class exception should be JSON serializable, got false." );
}
- function provideExceptionClasses() {
+ public function provideExceptionClasses() {
return array(
array( 'Exception' ),
array( 'MWException' ),
* @param $key String Name of the key to validate in the serialized JSON
* @dataProvider provideJsonSerializedKeys
*/
- function testJsonserializeexceptionKeys( $expectedKeyType, $exClass, $key ) {
+ public function testJsonserializeexceptionKeys( $expectedKeyType, $exClass, $key ) {
# Make sure we log a backtrace:
$this->setMwGlobals( array( 'wgLogExceptionBacktrace' => true ) );
/**
* Returns test cases: exception class, key name, gettype()
*/
- function provideJsonSerializedKeys() {
+ public function provideJsonSerializedKeys() {
$testCases = array();
foreach ( array( 'Exception', 'MWException' ) as $exClass ) {
$exTests = array(
*
* @covers MWExceptionHandler::jsonSerializeException
*/
- function testJsonserializeexceptionBacktracingEnabled() {
+ public function testJsonserializeexceptionBacktracingEnabled() {
$this->setMwGlobals( array( 'wgLogExceptionBacktrace' => true ) );
$json = json_decode(
MWExceptionHandler::jsonSerializeException( new Exception() )
*
* @covers MWExceptionHandler::jsonSerializeException
*/
- function testJsonserializeexceptionBacktracingDisabled() {
+ public function testJsonserializeexceptionBacktracingDisabled() {
$this->setMwGlobals( array( 'wgLogExceptionBacktrace' => false ) );
$json = json_decode(
MWExceptionHandler::jsonSerializeException( new Exception() )