MediaWiki master
|
Format errors and warnings in the old style, for backwards compatibility. More...
Inherits MediaWiki\Api\ApiErrorFormatter.
Public Member Functions | |
__construct (ApiResult $result) | |
arrayFromStatus (StatusValue $status, $type='error', $format=null) | |
Format messages from a StatusValue as an array. | |
formatException (Throwable $exception, array $options=[]) | |
Format a throwable as an array. | |
getFormat () | |
Fetch the format for this formatter. | |
Public Member Functions inherited from MediaWiki\Api\ApiErrorFormatter | |
__construct (ApiResult $result, Language $lang, $format, $useDB=false) | |
addError ( $modulePath, $msg, $code=null, $data=null) | |
Add an error to the result. | |
addMessagesFromStatus ( $modulePath, StatusValue $status, $types=[ 'warning', 'error'], array $filter=[]) | |
Add warnings and errors from a StatusValue object to the result. | |
addWarning ( $modulePath, $msg, $code=null, $data=null) | |
Add a warning to the result. | |
formatMessage ( $msg, $format=null) | |
Format a message as an array. | |
getContextTitle () | |
Get the page used for rendering error messages, e.g. | |
getLanguage () | |
Fetch the Language for this formatter. | |
getMessageFromException (Throwable $exception, array $options=[]) | |
Get an ApiMessage from a throwable. | |
newWithFormat ( $format) | |
Return a formatter like this one but with a different format. | |
setContextTitle (PageReference $title) | |
Set the page used for rendering error messages, e.g. | |
Protected Member Functions | |
addWarningOrError ( $tag, $modulePath, $msg) | |
Actually add the warning or error to the result. | |
formatMessageInternal ( $msg, $format) | |
Format a message as an array. | |
Protected Member Functions inherited from MediaWiki\Api\ApiErrorFormatter | |
getDummyTitle () | |
Fetch a dummy title to set on Messages. | |
Additional Inherited Members | |
Static Public Member Functions inherited from MediaWiki\Api\ApiErrorFormatter | |
static | isValidApiCode ( $code) |
Test whether a code is a valid API error code. | |
static | stripMarkup ( $text) |
Turn wikitext into something resembling plaintext. | |
Protected Attributes inherited from MediaWiki\Api\ApiErrorFormatter | |
string | $format = 'none' |
Language | $lang |
ApiResult | $result |
bool | $useDB = false |
Format errors and warnings in the old style, for backwards compatibility.
Definition at line 34 of file ApiErrorFormatter_BackCompat.php.
MediaWiki\Api\ApiErrorFormatter_BackCompat::__construct | ( | ApiResult | $result | ) |
ApiResult | $result | Into which data will be added |
Definition at line 39 of file ApiErrorFormatter_BackCompat.php.
References MediaWiki\Api\ApiErrorFormatter\$result, MediaWiki\MediaWikiServices\getInstance(), and MediaWiki\Api\ApiErrorFormatter\getLanguage().
|
protected |
Actually add the warning or error to the result.
string | $tag | 'warning' or 'error' |
string | null | $modulePath | |
ApiMessage | ApiRawMessage | $msg |
Reimplemented from MediaWiki\Api\ApiErrorFormatter.
Definition at line 94 of file ApiErrorFormatter_BackCompat.php.
References $path, MediaWiki\Api\ApiResult\ADD_ON_TOP, MediaWiki\Api\ApiResult\NO_SIZE_CHECK, MediaWiki\Api\ApiResult\OVERRIDE, and MediaWiki\Api\ApiErrorFormatter\stripMarkup().
MediaWiki\Api\ApiErrorFormatter_BackCompat::arrayFromStatus | ( | StatusValue | $status, |
$type = 'error', | |||
$format = null ) |
Format messages from a StatusValue as an array.
StatusValue | $status | |
string | $type | 'warning' or 'error' |
string | null | $format |
Reimplemented from MediaWiki\Api\ApiErrorFormatter.
Definition at line 52 of file ApiErrorFormatter_BackCompat.php.
References MediaWiki\Api\ApiErrorFormatter\$result, MediaWiki\Api\ApiMessage\create(), StatusValue\getMessages(), StatusValue\isGood(), and MediaWiki\Api\ApiResult\setIndexedTagName().
MediaWiki\Api\ApiErrorFormatter_BackCompat::formatException | ( | Throwable | $exception, |
array | $options = [] ) |
Format a throwable as an array.
Throwable | $exception | |
array | $options | See parent::formatException(), plus
|
Reimplemented from MediaWiki\Api\ApiErrorFormatter.
Definition at line 89 of file ApiErrorFormatter_BackCompat.php.
|
protected |
Format a message as an array.
ApiMessage | ApiRawMessage | $msg | |
string | null | $format |
Reimplemented from MediaWiki\Api\ApiErrorFormatter.
Definition at line 74 of file ApiErrorFormatter_BackCompat.php.
MediaWiki\Api\ApiErrorFormatter_BackCompat::getFormat | ( | ) |
Fetch the format for this formatter.
Reimplemented from MediaWiki\Api\ApiErrorFormatter.
Definition at line 48 of file ApiErrorFormatter_BackCompat.php.