Go to the documentation of this file.
47 foreach (
$status->getErrorsByType(
$type ) as $error ) {
50 'message' => $msg->getKey(),
51 'params' => $msg->getParams(),
52 'code' => $msg->getApiCode(),
64 'code' => $msg->getApiCode(),
65 'info' => $msg->text(),
66 ] + $msg->getApiData();
78 $ret = parent::formatException( $exception, $options );
79 return empty( $options[
'bc'] ) ? $ret : $ret[
'info'];
85 if ( $tag ===
'error' ) {
87 $existingError = $this->result->getResultData( [
'error' ] );
88 if ( !is_array( $existingError ) ||
89 !isset( $existingError[
'code'] ) || !isset( $existingError[
'info'] )
92 'code' => $msg->getApiCode(),
94 ] + $msg->getApiData();
95 $this->result->addValue(
null,
'error', $value,
99 if ( $modulePath ===
null ) {
100 $moduleName =
'unknown';
102 $i = strrpos( $modulePath,
'+' );
103 $moduleName = $i ===
false ? $modulePath : substr( $modulePath, $i + 1 );
108 $path = [ $tag, $moduleName ];
109 $oldWarning = $this->result->getResultData( [ $tag, $moduleName, $tag ] );
110 if ( $oldWarning !==
null ) {
111 $warnPos = strpos( $oldWarning, $value );
113 if ( $warnPos !==
false && ( $warnPos === 0 || $oldWarning[$warnPos - 1] ===
"\n" ) ) {
115 $warnPos += strlen( $value );
116 if ( strlen( $oldWarning ) <= $warnPos || $oldWarning[$warnPos] ===
"\n" ) {
121 $value =
"$oldWarning\n$value";
123 $this->result->addContentValue(
$path, $tag, $value,
Generic operation result class Has warning/error list, boolean status and arbitrary value.
const NO_SIZE_CHECK
For addValue() and similar functions, do not check size while adding a value Don't use this unless yo...
This class represents the result of the API operations.
static create( $msg, $code=null, array $data=null)
Create an IApiMessage for the message.
static setIndexedTagName(array &$arr, $tag)
Set the tag name for numeric-keyed values in XML format.
const ADD_ON_TOP
For addValue(), setValue() and similar functions, if the value does not exist, add it as the first el...
const OVERRIDE
Override existing value in addValue(), setValue(), and similar functions.
static factory( $code)
Get a cached or new language object for a given language code.