MediaWiki  1.30.0
ApiErrorFormatter_BackCompat Class Reference

Format errors and warnings in the old style, for backwards compatibility. More...

Inheritance diagram for ApiErrorFormatter_BackCompat:
Collaboration diagram for ApiErrorFormatter_BackCompat:

Public Member Functions

 __construct (ApiResult $result)
 
 arrayFromStatus (StatusValue $status, $type='error', $format=null)
 Format messages from a StatusValue as an array. More...
 
 formatException ( $exception, array $options=[])
 Format an exception as an array. More...
 
- Public Member Functions inherited from ApiErrorFormatter
 __construct (ApiResult $result, Language $lang, $format, $useDB=false)
 
 addError ( $modulePath, $msg, $code=null, $data=null)
 Add an error to the result. More...
 
 addMessagesFromStatus ( $modulePath, StatusValue $status, $types=[ 'warning', 'error'])
 Add warnings and errors from a StatusValue object to the result. More...
 
 addWarning ( $modulePath, $msg, $code=null, $data=null)
 Add a warning to the result. More...
 
 formatMessage ( $msg, $format=null)
 Format a message as an array. More...
 
 getLanguage ()
 Fetch the Language for this formatter. More...
 
 getMessageFromException ( $exception, array $options=[])
 Get an ApiMessage from an exception. More...
 

Protected Member Functions

 addWarningOrError ( $tag, $modulePath, $msg)
 Actually add the warning or error to the result. More...
 
 formatMessageInternal ( $msg, $format)
 Format a message as an array. More...
 
- Protected Member Functions inherited from ApiErrorFormatter
 getDummyTitle ()
 Fetch a dummy title to set on Messages. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from ApiErrorFormatter
static stripMarkup ( $text)
 Turn wikitext into something resembling plaintext. More...
 
- Protected Attributes inherited from ApiErrorFormatter
 $format = 'none'
 
Language $lang
 
ApiResult $result
 
 $useDB = false
 

Detailed Description

Format errors and warnings in the old style, for backwards compatibility.

Since
1.25
Deprecated:
Only for backwards compatibility, do not use

Definition at line 362 of file ApiErrorFormatter.php.

Constructor & Destructor Documentation

◆ __construct()

ApiErrorFormatter_BackCompat::__construct ( ApiResult  $result)
Parameters
ApiResult$resultInto which data will be added

Definition at line 368 of file ApiErrorFormatter.php.

References Language\factory().

Member Function Documentation

◆ addWarningOrError()

ApiErrorFormatter_BackCompat::addWarningOrError (   $tag,
  $modulePath,
  $msg 
)
protected

Actually add the warning or error to the result.

Parameters
string$tag'warning' or 'error'
string | null$modulePath
ApiMessage | ApiRawMessage$msg

Reimplemented from ApiErrorFormatter.

Definition at line 413 of file ApiErrorFormatter.php.

References $path, $value, ApiResult\ADD_ON_TOP, ApiResult\NO_SIZE_CHECK, ApiResult\OVERRIDE, and ApiErrorFormatter\stripMarkup().

◆ arrayFromStatus()

ApiErrorFormatter_BackCompat::arrayFromStatus ( StatusValue  $status,
  $type = 'error',
  $format = null 
)

Format messages from a StatusValue as an array.

Parameters
StatusValue$status
string$type'warning' or 'error'
string | null$format
Returns
array

Reimplemented from ApiErrorFormatter.

Definition at line 372 of file ApiErrorFormatter.php.

References ApiErrorFormatter\$result, $type, as, ApiMessage\create(), and ApiResult\setIndexedTagName().

◆ formatException()

ApiErrorFormatter_BackCompat::formatException (   $exception,
array  $options = [] 
)

Format an exception as an array.

Since
1.29
Parameters
Exception | Throwable$exception
array$optionsSee parent::formatException(), plus
  • bc: (bool) Return only the string, not an array
Returns
array|string

Reimplemented from ApiErrorFormatter.

Definition at line 408 of file ApiErrorFormatter.php.

References $options, and $ret.

◆ formatMessageInternal()

ApiErrorFormatter_BackCompat::formatMessageInternal (   $msg,
  $format 
)
protected

Format a message as an array.

Since
1.29
Parameters
ApiMessage | ApiRawMessage$msg
string | null$format
Returns
array

Reimplemented from ApiErrorFormatter.

Definition at line 393 of file ApiErrorFormatter.php.


The documentation for this class was generated from the following file: