MediaWiki
1.28.0
|
This class represents the result of the API operations. More...
Public Member Functions | |
__construct ($maxSize) | |
serializeForApiResult () | |
Allow for adding one ApiResult into another. More... | |
setErrorFormatter (ApiErrorFormatter $formatter) | |
Set the error formatter. More... | |
Public Attributes | |
$mainForContinuation | |
$maxSize | |
$size | |
const | ADD_ON_TOP = 2 |
For addValue(), setValue() and similar functions, if the value does not exist, add it as the first element. More... | |
const | META_BC_BOOLS = '_BC_bools' |
Key for the 'BC bools' metadata item. More... | |
const | META_BC_SUBELEMENTS = '_BC_subelements' |
Key for the 'BC subelements' metadata item. More... | |
const | META_CONTENT = '_content' |
Key for the 'content' metadata item. More... | |
const | META_INDEXED_TAG_NAME = '_element' |
Key for the 'indexed tag name' metadata item. More... | |
const | META_KVP_KEY_NAME = '_kvpkeyname' |
Key for the metadata item whose value specifies the name used for the kvp key in the alternative output format with META_TYPE 'kvp' or 'BCkvp', i.e. More... | |
const | META_KVP_MERGE = '_kvpmerge' |
Key for the metadata item that indicates that the KVP key should be added into an assoc value, i.e. More... | |
const | META_PRESERVE_KEYS = '_preservekeys' |
Key for the 'preserve keys' metadata item. More... | |
const | META_SUBELEMENTS = '_subelements' |
Key for the 'subelements' metadata item. More... | |
const | META_TYPE = '_type' |
Key for the 'type' metadata item. More... | |
const | NO_SIZE_CHECK = 4 |
For addValue() and similar functions, do not check size while adding a value Don't use this unless you REALLY know what you're doing. More... | |
const | NO_VALIDATE = 12 |
For addValue(), setValue() and similar functions, do not validate data. More... | |
const | OVERRIDE = 1 |
Override existing value in addValue(), setValue(), and similar functions. More... | |
Private Attributes | |
$checkingSize | |
$data | |
$errorFormatter | |
Content | |
reset () | |
Clear the current result data. More... | |
getResultData ($path=[], $transforms=[]) | |
Get the result data array. More... | |
getSize () | |
Get the size of the result, i.e. More... | |
addValue ($path, $name, $value, $flags=0) | |
Add value to the output data at the given path. More... | |
removeValue ($path, $name, $flags=0) | |
Remove value from the output data at the given path. More... | |
addContentValue ($path, $name, $value, $flags=0) | |
Add value to the output data at the given path and mark as META_CONTENT. More... | |
addParsedLimit ($moduleName, $limit) | |
Add the numeric limit for a limit=max to the result. More... | |
static | setValue (array &$arr, $name, $value, $flags=0) |
Add an output value to the array by name. More... | |
static | unsetValue (array &$arr, $name) |
Remove an output value to the array by name. More... | |
static | setContentValue (array &$arr, $name, $value, $flags=0) |
Add an output value to the array by name and mark as META_CONTENT. More... | |
static | validateValue ($value) |
Validate a value for addition to the result. More... | |
Metadata | |
addContentField ($path, $name, $flags=0) | |
Set the name of the content field name (META_CONTENT) More... | |
addSubelementsList ($path, $names) | |
Causes the elements with the specified names to be output as subelements rather than attributes. More... | |
removeSubelementsList ($path, $names) | |
Causes the elements with the specified names to be output as attributes (when possible) rather than as subelements. More... | |
addIndexedTagName ($path, $tag) | |
Set the tag name for numeric-keyed values in XML format. More... | |
addIndexedTagNameRecursive ($path, $tag) | |
Set indexed tag name on $path and all subarrays. More... | |
addPreserveKeysList ($path, $names) | |
Preserve specified keys. More... | |
removePreserveKeysList ($path, $names) | |
Don't preserve specified keys. More... | |
addArrayType ($path, $tag, $kvpKeyName=null) | |
Set the array data type for a path. More... | |
addArrayTypeRecursive ($path, $tag, $kvpKeyName=null) | |
Set the array data type for a path recursively. More... | |
static | setContentField (array &$arr, $name, $flags=0) |
Set the name of the content field name (META_CONTENT) More... | |
static | setSubelementsList (array &$arr, $names) |
Causes the elements with the specified names to be output as subelements rather than attributes. More... | |
static | unsetSubelementsList (array &$arr, $names) |
Causes the elements with the specified names to be output as attributes (when possible) rather than as subelements. More... | |
static | setIndexedTagName (array &$arr, $tag) |
Set the tag name for numeric-keyed values in XML format. More... | |
static | setIndexedTagNameRecursive (array &$arr, $tag) |
Set indexed tag name on $arr and all subarrays. More... | |
static | setPreserveKeysList (array &$arr, $names) |
Preserve specified keys. More... | |
static | unsetPreserveKeysList (array &$arr, $names) |
Don't preserve specified keys. More... | |
static | setArrayType (array &$arr, $type, $kvpKeyName=null) |
Set the array data type. More... | |
static | setArrayTypeRecursive (array &$arr, $type, $kvpKeyName=null) |
Set the array data type recursively. More... | |
Utility | |
static | isMetadataKey ($key) |
Test whether a key should be considered metadata. More... | |
static | stripMetadata ($data) |
Recursively remove metadata keys from a data array or object. More... | |
static | stripMetadataNonRecursive ($data, &$metadata=null) |
Remove metadata keys from a data array or object, non-recursive. More... | |
static | addMetadataToResultVars ($vars, $forceHash=true) |
Add the correct metadata to an array of vars we want to export through the API. More... | |
static | size ($value) |
Get the 'real' size of a result item. More... | |
static | applyTransformations (array $dataIn, array $transforms) |
Apply transformations to an array, returning the transformed array. More... | |
& | path ($path, $create= 'append') |
Return a reference to the internal data at $path. More... | |
This class represents the result of the API operations.
It simply wraps a nested array structure, adding some functions to simplify array's modifications. As various modules execute, they add different pieces of information to this result, structuring it as it will be given to the client.
Each subarray may either be a dictionary - key-value pairs with unique keys, or lists, where the items are added using $data[] = $value notation.
Definition at line 33 of file ApiResult.php.
ApiResult::__construct | ( | $maxSize | ) |
int | bool | $maxSize | Maximum result "size", or false for no limit |
Definition at line 153 of file ApiResult.php.
References $maxSize, reset(), and wfDeprecated().
ApiResult::addArrayType | ( | $path, | |
$tag, | |||
$kvpKeyName = null |
|||
) |
Set the array data type for a path.
array | string | null | $path | See ApiResult::addValue() |
string | $tag | See ApiResult::META_TYPE |
string | $kvpKeyName | See ApiResult::META_KVP_KEY_NAME |
Definition at line 749 of file ApiResult.php.
ApiResult::addArrayTypeRecursive | ( | $path, | |
$tag, | |||
$kvpKeyName = null |
|||
) |
Set the array data type for a path recursively.
array | string | null | $path | See ApiResult::addValue() |
string | $tag | See ApiResult::META_TYPE |
string | $kvpKeyName | See ApiResult::META_KVP_KEY_NAME |
Definition at line 777 of file ApiResult.php.
ApiResult::addContentField | ( | $path, | |
$name, | |||
$flags = 0 |
|||
) |
Set the name of the content field name (META_CONTENT)
array | string | null | $path | See ApiResult::addValue() |
string | int | $name | Name of the field |
int | $flags | Zero or more OR-ed flags like OVERRIDE | ADD_ON_TOP. |
Definition at line 555 of file ApiResult.php.
References $flags, $name, $path, ADD_ON_TOP, and path().
Referenced by addContentValue().
ApiResult::addContentValue | ( | $path, | |
$name, | |||
$value, | |||
$flags = 0 |
|||
) |
Add value to the output data at the given path and mark as META_CONTENT.
array | string | null | $path | See ApiResult::addValue() |
string | int | $name | See ApiResult::setValue() |
mixed | $value | |
int | $flags | Zero or more OR-ed flags like OVERRIDE | ADD_ON_TOP. |
Definition at line 498 of file ApiResult.php.
References $flags, $name, $path, $value, addContentField(), and addValue().
ApiResult::addIndexedTagName | ( | $path, | |
$tag | |||
) |
Set the tag name for numeric-keyed values in XML format.
array | string | null | $path | See ApiResult::addValue() |
string | $tag | Tag name |
Definition at line 631 of file ApiResult.php.
ApiResult::addIndexedTagNameRecursive | ( | $path, | |
$tag | |||
) |
Set indexed tag name on $path and all subarrays.
array | string | null | $path | See ApiResult::addValue() |
string | $tag | Tag name |
Definition at line 662 of file ApiResult.php.
|
static |
Add the correct metadata to an array of vars we want to export through the API.
array | $vars | |
bool | $forceHash |
Definition at line 1154 of file ApiResult.php.
References $keys, $vars, array(), as, META_BC_BOOLS, META_INDEXED_TAG_NAME, META_KVP_KEY_NAME, META_PRESERVE_KEYS, and META_TYPE.
Referenced by ApiExpandTemplates\execute(), ApiParse\execute(), and ApiResultTest\testAddMetadataToResultVars().
ApiResult::addParsedLimit | ( | $moduleName, | |
$limit | |||
) |
Add the numeric limit for a limit=max to the result.
string | $moduleName | |
int | $limit |
Definition at line 513 of file ApiResult.php.
References $limit, addValue(), NO_SIZE_CHECK, and OVERRIDE.
ApiResult::addPreserveKeysList | ( | $path, | |
$names | |||
) |
Preserve specified keys.
array | string | null | $path | See ApiResult::addValue() |
array | string | $names | The element name(s) to preserve |
Definition at line 692 of file ApiResult.php.
ApiResult::addSubelementsList | ( | $path, | |
$names | |||
) |
Causes the elements with the specified names to be output as subelements rather than attributes.
array | string | null | $path | See ApiResult::addValue() |
array | string | int | $names | The element name(s) to be output as subelements |
Definition at line 582 of file ApiResult.php.
ApiResult::addValue | ( | $path, | |
$name, | |||
$value, | |||
$flags = 0 |
|||
) |
Add value to the output data at the given path.
Path can be an indexed array, each element specifying the branch at which to add the new value. Setting $path to [ 'a', 'b', 'c' ] is equivalent to data['a']['b']['c'] = $value. If $path is null, the value will be inserted at the data root.
array | string | int | null | $path | |
string | int | null | $name | See ApiResult::setValue() |
mixed | $value | |
int | $flags | Zero or more OR-ed flags like OVERRIDE | ADD_ON_TOP. This parameter used to be boolean, and the value of OVERRIDE=1 was specifically chosen so that it would be backwards compatible with the new method signature. |
Definition at line 405 of file ApiResult.php.
References $flags, $name, $path, $value, ADD_ON_TOP, NO_SIZE_CHECK, NO_VALIDATE, path(), and size().
Referenced by addContentValue(), addParsedLimit(), MWDebug\appendDebugInfoToApiResult(), and ApiContinuationManager\setContinuationIntoResult().
Apply transformations to an array, returning the transformed array.
array | $dataIn | |
array | $transforms |
Definition at line 808 of file ApiResult.php.
References $data, $keys, $ret, $type, array(), as, and object.
ApiResult::getResultData | ( | $path = [] , |
|
$transforms = [] |
|||
) |
Get the result data array.
The returned value should be considered read-only.
Transformations include:
Custom: (callable) Applied before other transformations. Signature is function ( &$data, &$metadata ), return value is ignored. Called for each nested array.
BC: (array) This transformation does various adjustments to bring the output in line with the pre-1.25 result format. The value array is a list of flags: 'nobool', 'no*', 'nosub'.
Types: (assoc) Apply transformations based on META_TYPE. The values array is an associative array with the following possible keys:
Strip: (string) Strips metadata keys from the result.
array | string | null | $path | Path to fetch, see ApiResult::addValue |
array | $transforms | See above |
Definition at line 252 of file ApiResult.php.
References $last, $path, $ret, array(), data, and path().
Referenced by ApiErrorFormatter\arrayFromStatus().
ApiResult::getSize | ( | ) |
Get the size of the result, i.e.
the amount of bytes in it
Definition at line 273 of file ApiResult.php.
References $size.
|
static |
Test whether a key should be considered metadata.
string | $key |
Definition at line 795 of file ApiResult.php.
Referenced by ApiFeedWatchlist\execute(), and ApiFormatXml\recXmlPrint().
|
private |
Return a reference to the internal data at $path.
array | string | null | $path | |
string | $create | If 'append', append empty arrays. If 'prepend', prepend empty arrays. If 'dummy', return a dummy array. Else, raise an error. |
Definition at line 1117 of file ApiResult.php.
References $data, $path, $ret, array(), and as.
Referenced by addArrayType(), addArrayTypeRecursive(), addContentField(), addIndexedTagName(), addIndexedTagNameRecursive(), addPreserveKeysList(), addSubelementsList(), addValue(), getResultData(), removePreserveKeysList(), removeSubelementsList(), and removeValue().
ApiResult::removePreserveKeysList | ( | $path, | |
$names | |||
) |
Don't preserve specified keys.
array | string | null | $path | See ApiResult::addValue() |
array | string | $names | The element name(s) to not preserve |
Definition at line 717 of file ApiResult.php.
ApiResult::removeSubelementsList | ( | $path, | |
$names | |||
) |
Causes the elements with the specified names to be output as attributes (when possible) rather than as subelements.
array | string | null | $path | See ApiResult::addValue() |
array | string | int | $names | The element name(s) to not be output as subelements |
Definition at line 607 of file ApiResult.php.
ApiResult::removeValue | ( | $path, | |
$name, | |||
$flags = 0 |
|||
) |
Remove value from the output data at the given path.
array | string | null | $path | See ApiResult::addValue() |
string | int | null | $name | Index to remove at $path. If null, $path itself is removed. |
int | $flags | Flags used when adding the value |
Definition at line 455 of file ApiResult.php.
References $flags, $name, $path, $ret, array(), NO_SIZE_CHECK, path(), and size().
ApiResult::reset | ( | ) |
Clear the current result data.
Definition at line 192 of file ApiResult.php.
Referenced by __construct().
ApiResult::serializeForApiResult | ( | ) |
Allow for adding one ApiResult into another.
Implements ApiSerializable.
Definition at line 180 of file ApiResult.php.
References $data.
|
static |
Set the array data type.
array | &$arr | |
string | $type | See ApiResult::META_TYPE |
string | $kvpKeyName | See ApiResult::META_KVP_KEY_NAME |
Definition at line 730 of file ApiResult.php.
References $type.
Referenced by ApiQueryPageProps\addPageProps(), ApiQuerySiteinfo\appendExtensionTags(), ApiQuerySiteinfo\appendFunctionHooks(), ApiQuerySiteinfo\appendGeneralInfo(), ApiQuerySiteinfo\appendNamespaces(), ApiQuerySiteinfo\appendProtocols(), ApiQuerySiteinfo\appendRestrictions(), ApiQuerySiteinfo\appendSubscribedHooks(), ApiQuerySiteinfo\appendUserGroups(), ApiQuerySiteinfo\appendVariables(), ApiExpandTemplates\execute(), ApiQueryFileRepoInfo\execute(), ApiParse\execute(), ApiQueryAllUsers\execute(), ApiResetPassword\execute(), ApiQueryUsers\execute(), ApiAuthManagerHelper\formatFields(), LogFormatter\formatParametersForApi(), LogFormatter\formatParameterValueForApi(), ApiQueryUserInfo\getCentralUserInfo(), ApiQueryUserInfo\getCurrentUserInfo(), ApiQuery\outputGeneralPageInfo(), LogFormatterTest\testApiParamFormatting(), and ApiResultTest\testMetadata().
|
static |
Set the array data type recursively.
array | &$arr | |
string | $type | See ApiResult::META_TYPE |
string | $kvpKeyName | See ApiResult::META_KVP_KEY_NAME |
Definition at line 761 of file ApiResult.php.
Referenced by ApiQueryFileRepoInfo\execute(), and ApiResultTest\testMetadata().
|
static |
Set the name of the content field name (META_CONTENT)
array | &$arr | |
string | int | $name | Name of the field |
int | $flags | Zero or more OR-ed flags like OVERRIDE | ADD_ON_TOP. |
Definition at line 534 of file ApiResult.php.
|
static |
Add an output value to the array by name and mark as META_CONTENT.
array | &$arr | To add $value to |
string | int | $name | Index of $arr to add $value at. |
mixed | $value | |
int | $flags | Zero or more OR-ed flags like OVERRIDE | ADD_ON_TOP. |
Definition at line 480 of file ApiResult.php.
References $flags, $name, and $value.
Referenced by ApiQuerySiteinfo\appendLanguages(), ApiQuerySiteinfo\appendNamespaceAliases(), ApiQuerySiteinfo\appendNamespaces(), ApiQuerySiteinfo\appendSkins(), ApiComparePages\execute(), ApiExpandTemplates\execute(), ApiQueryAllMessages\execute(), ApiQueryExternalLinks\execute(), ApiQueryLangLinks\execute(), ApiQueryDeletedrevs\execute(), ApiQueryIWLinks\execute(), ApiQueryRevisionsBase\extractRevisionInfo(), ApiParse\formatCategoryLinks(), ApiParse\formatHeadItems(), ApiParse\formatIWLinks(), ApiParse\formatLangLinks(), ApiParse\formatLinks(), ApiRsd\formatRsdApiList(), ApiQueryUserInfo\getCurrentUserInfo(), ApiQueryAllCategories\run(), ApiMain\substituteResultWithError(), ApiResultTest\testInstanceDataMethods(), and ApiResultTest\testStaticDataMethods().
ApiResult::setErrorFormatter | ( | ApiErrorFormatter | $formatter | ) |
Set the error formatter.
ApiErrorFormatter | $formatter |
Definition at line 171 of file ApiResult.php.
|
static |
Set the tag name for numeric-keyed values in XML format.
array | &$arr | |
string | $tag | Tag name |
Definition at line 618 of file ApiResult.php.
References $tag.
Referenced by ApiQueryBase\addPageSubItems(), ApiErrorFormatter\addWarningOrError(), ApiQuerySiteinfo\appendDbReplLagInfo(), MWDebug\appendDebugInfoToApiResult(), ApiQuerySiteinfo\appendExtensions(), ApiQuerySiteinfo\appendExtensionTags(), ApiQuerySiteinfo\appendFileExtensions(), ApiQuerySiteinfo\appendFunctionHooks(), ApiQuerySiteinfo\appendGeneralInfo(), ApiQuerySiteinfo\appendInstalledLibraries(), ApiQuerySiteinfo\appendInterwikiMap(), ApiQuerySiteinfo\appendLanguages(), ApiQuerySiteinfo\appendMagicWords(), ApiQuerySiteinfo\appendNamespaceAliases(), ApiQuerySiteinfo\appendNamespaces(), ApiQuerySiteinfo\appendProtocols(), ApiQuerySiteinfo\appendRestrictions(), ApiQuerySiteinfo\appendSkins(), ApiQuerySiteinfo\appendSpecialPageAliases(), ApiQuerySiteinfo\appendSubscribedHooks(), ApiQuerySiteinfo\appendUserGroups(), ApiQuerySiteinfo\appendVariables(), ApiErrorFormatter_BackCompat\arrayFromStatus(), ApiUpload\checkVerification(), ApiImageRotate\execute(), ApiTag\execute(), ApiProtect\execute(), ApiMove\execute(), ApiRevisionDelete\execute(), ApiImport\execute(), ApiRsd\execute(), ApiWatch\execute(), ApiExpandTemplates\execute(), ApiSetNotificationTimestamp\execute(), ApiEditPage\execute(), ApiPurge\execute(), ApiQueryDeletedrevs\execute(), ApiParamInfo\execute(), ApiQueryFileRepoInfo\execute(), ApiQueryAllUsers\execute(), ApiUserrights\execute(), ApiResetPassword\execute(), ApiQueryUsers\execute(), ApiQueryInfo\extractPageInfo(), ApiQueryRevisionsBase\extractRevisionInfo(), ApiQueryLogEvents\extractRowInfo(), ApiQueryContributions\extractRowInfo(), ApiQueryRecentChanges\extractRowInfo(), ApiRevisionDelete\extractStatusInfo(), ApiParamInfo\formatHelpMessages(), ApiAuthManagerHelper\formatMessage(), RightsLogFormatter\formatParametersForApi(), BlockLogFormatter\formatParametersForApi(), DeleteLogFormatter\formatParametersForApi(), LogFormatter\formatParametersForApi(), ApiRsd\formatRsdApiList(), ApiRevisionDelete\formatStatusMessages(), ApiPageSet\getConvertedTitlesAsResult(), ApiQueryUserInfo\getCurrentUserInfo(), ApiPageSet\getInterwikiTitlesAsResult(), ApiPageSet\getMissingRevisionIDsAsResult(), ApiParamInfo\getModuleInfo(), ApiPageSet\getNormalizedTitlesAsResult(), ApiPageSet\getRedirectTitlesAsResult(), ApiQuery\outputGeneralPageInfo(), ApiUpload\performUpload(), ApiOpenSearch\populateResult(), ApiTag\processIndividual(), ApiQueryImageInfo\processMetaData(), ApiQueryAllRevisions\run(), ApiQueryAllDeletedRevisions\run(), ApiQueryBacklinks\run(), ApiParse\setIndexedTagNames(), LogFormatterTest\testApiParamFormatting(), ApiResultTest\testMetadata(), and ApiUpload\transformWarnings().
|
static |
Set indexed tag name on $arr and all subarrays.
array | &$arr | |
string | $tag | Tag name |
Definition at line 643 of file ApiResult.php.
Referenced by ApiParse\formatLimitReportData(), and ApiResultTest\testMetadata().
|
static |
Preserve specified keys.
This prevents XML name mangling and preventing keys from being removed by self::stripMetadata().
array | &$arr | |
array | string | $names | The element name(s) to preserve |
Definition at line 677 of file ApiResult.php.
References array().
Referenced by FormatMetadata\sanitizeArrayForAPI(), and ApiResultTest\testMetadata().
|
static |
Causes the elements with the specified names to be output as subelements rather than attributes.
array | &$arr | |
array | string | int | $names | The element name(s) to be output as subelements |
Definition at line 567 of file ApiResult.php.
References array().
Referenced by ApiRsd\execute(), ApiExpandTemplates\execute(), ApiHelp\execute(), ApiRsd\formatRsdApiList(), ApiParamInfo\getModuleInfo(), ApiOpenSearch\populateResult(), and ApiResultTest\testMetadata().
|
static |
Add an output value to the array by name.
Verifies that value with the same name has not been added before.
array | &$arr | To add $value to |
string | int | null | $name | Index of $arr to add $value at, or null to use the next numeric index. |
mixed | $value | |
int | $flags | Zero or more OR-ed flags like OVERRIDE | ADD_ON_TOP. |
Definition at line 289 of file ApiResult.php.
References $flags, $keys, $name, $value, ADD_ON_TOP, NO_VALIDATE, and OVERRIDE.
Referenced by ApiResultTest\testObjectSerialization(), and ApiResultTest\testStaticDataMethods().
|
staticprivate |
Get the 'real' size of a result item.
This means the strlen() of the item, or the sum of the strlen()s of the elements if the item is an array.
mixed | $value | Validated value (see self::validateValue()) |
Definition at line 1091 of file ApiResult.php.
References $s, $value, and as.
Referenced by addValue(), removeValue(), and reset().
|
static |
Recursively remove metadata keys from a data array or object.
Note this removes all potential metadata keys, not just the defined ones.
array | object | $data |
Definition at line 1026 of file ApiResult.php.
References $data, array(), as, and object.
Referenced by ApiResultTest\testUtilityFunctions().
|
static |
Remove metadata keys from a data array or object, non-recursive.
Note this removes all potential metadata keys, not just the defined ones.
array | object | $data | |
array | &$metadata | Store metadata here, if provided |
Definition at line 1060 of file ApiResult.php.
References $data, array(), as, and object.
Referenced by ApiQuery\outputGeneralPageInfo(), and ApiResultTest\testUtilityFunctions().
|
static |
Don't preserve specified keys.
array | &$arr | |
array | string | $names | The element name(s) to not preserve |
Definition at line 704 of file ApiResult.php.
References array().
Referenced by ApiResultTest\testMetadata().
|
static |
Causes the elements with the specified names to be output as attributes (when possible) rather than as subelements.
array | &$arr | |
array | string | int | $names | The element name(s) to not be output as subelements |
Definition at line 594 of file ApiResult.php.
References array().
Referenced by ApiResultTest\testMetadata().
|
static |
Remove an output value to the array by name.
array | &$arr | To remove $value from |
string | int | $name | Index of $arr to remove |
Definition at line 436 of file ApiResult.php.
Referenced by ApiResultTest\testStaticDataMethods().
|
staticprivate |
Validate a value for addition to the result.
mixed | $value |
Definition at line 332 of file ApiResult.php.
References $type, $value, $wgContLang, array(), as, global, and string.
|
private |
Definition at line 147 of file ApiResult.php.
|
private |
Definition at line 143 of file ApiResult.php.
Referenced by applyTransformations(), path(), serializeForApiResult(), stripMetadata(), and stripMetadataNonRecursive().
|
private |
Definition at line 144 of file ApiResult.php.
ApiResult::$mainForContinuation |
Definition at line 147 of file ApiResult.php.
ApiResult::$maxSize |
Definition at line 143 of file ApiResult.php.
Referenced by __construct().
ApiResult::$size |
Definition at line 143 of file ApiResult.php.
Referenced by getSize().
const ApiResult::ADD_ON_TOP = 2 |
For addValue(), setValue() and similar functions, if the value does not exist, add it as the first element.
In case the new value has no name (numerical index), all indexes will be renumbered.
Definition at line 47 of file ApiResult.php.
Referenced by addContentField(), addValue(), ApiErrorFormatter\addWarningOrError(), ApiErrorFormatter_BackCompat\addWarningOrError(), ApiQuery\execute(), ApiContinuationManager\setContinuationIntoResult(), setValue(), ApiResultTest\testInstanceDataMethods(), and ApiResultTest\testStaticDataMethods().
const ApiResult::META_BC_BOOLS = '_BC_bools' |
Key for the 'BC bools' metadata item.
Value is string[]. Note no setter is provided.
Definition at line 134 of file ApiResult.php.
Referenced by addMetadataToResultVars(), ApiQuerySiteinfo\appendDefaultOptions(), ApiQuerySiteinfo\appendGeneralInfo(), ApiQueryUserInfo\getCurrentUserInfo(), ApiQueryImageInfo\processMetaData(), ApiFormatJsonTest\provideGeneralEncoding(), ApiFormatPhpTest\provideGeneralEncoding(), ApiFormatXmlTest\provideGeneralEncoding(), ApiResultTest\provideTransformations(), ApiFormatXml\recXmlPrint(), and ApiResultTest\testAddMetadataToResultVars().
const ApiResult::META_BC_SUBELEMENTS = '_BC_subelements' |
Key for the 'BC subelements' metadata item.
Value is string[]. Note no setter is provided.
Definition at line 141 of file ApiResult.php.
Referenced by ApiQuery\doExport(), ApiExpandTemplates\execute(), ApiParse\execute(), ApiFormatNoneTest\provideGeneralEncoding(), ApiFormatPhpTest\provideGeneralEncoding(), ApiFormatJsonTest\provideGeneralEncoding(), ApiFormatXmlTest\provideGeneralEncoding(), ApiResultTest\provideTransformations(), and ApiFormatXml\recXmlPrint().
const ApiResult::META_CONTENT = '_content' |
Key for the 'content' metadata item.
Value is string.
Definition at line 88 of file ApiResult.php.
Referenced by ApiErrorFormatter\addWarningOrError(), ApiResultTest\customTransform(), ApiErrorFormatterTest\provideErrorFormatter(), ApiFormatJsonTest\provideGeneralEncoding(), ApiFormatPhpTest\provideGeneralEncoding(), ApiFormatXmlTest\provideGeneralEncoding(), ApiResultTest\provideTransformations(), ApiFormatXml\recXmlPrint(), ApiErrorFormatterTest\testErrorFormatterBC(), ApiResultTest\testInstanceDataMethods(), and ApiResultTest\testStaticDataMethods().
const ApiResult::META_INDEXED_TAG_NAME = '_element' |
Key for the 'indexed tag name' metadata item.
Value is string.
Definition at line 70 of file ApiResult.php.
Referenced by addMetadataToResultVars(), ApiErrorFormatterTest\provideErrorFormatter(), ApiFormatXmlTest\provideGeneralEncoding(), ApiResultTest\provideTransformations(), ApiFormatXml\recXmlPrint(), ApiResultTest\testAddMetadataToResultVars(), ApiErrorFormatterTest\testErrorFormatterBC(), ApiResultTest\testMetadata(), and ApiResultTest\testUtilityFunctions().
const ApiResult::META_KVP_KEY_NAME = '_kvpkeyname' |
Key for the metadata item whose value specifies the name used for the kvp key in the alternative output format with META_TYPE 'kvp' or 'BCkvp', i.e.
the "name" in <container>value</container>. Value is string.
Definition at line 117 of file ApiResult.php.
Referenced by addMetadataToResultVars(), ApiFormatNoneTest\provideGeneralEncoding(), ApiFormatJsonTest\provideGeneralEncoding(), ApiFormatPhpTest\provideGeneralEncoding(), ApiFormatXmlTest\provideGeneralEncoding(), ApiResultTest\provideTransformations(), ApiResultTest\testAddMetadataToResultVars(), and ApiResultTest\testMetadata().
const ApiResult::META_KVP_MERGE = '_kvpmerge' |
Key for the metadata item that indicates that the KVP key should be added into an assoc value, i.e.
{"key":{"val1":"a","val2":"b"}} transforms to {"name":"key","val1":"a","val2":"b"} rather than {"name":"key","value":{"val1":"a","val2":"b"}}. Value is boolean.
Definition at line 127 of file ApiResult.php.
Referenced by ApiResultTest\provideTransformations().
const ApiResult::META_PRESERVE_KEYS = '_preservekeys' |
Key for the 'preserve keys' metadata item.
Value is string[].
Definition at line 82 of file ApiResult.php.
Referenced by addMetadataToResultVars(), ApiResultTest\customTransform(), ApiFormatXmlTest\provideGeneralEncoding(), ApiResultTest\provideTransformations(), ApiFormatXml\recXmlPrint(), ApiResultTest\testAddMetadataToResultVars(), ApiResultTest\testMetadata(), and ApiResultTest\testUtilityFunctions().
const ApiResult::META_SUBELEMENTS = '_subelements' |
Key for the 'subelements' metadata item.
Value is string[].
Definition at line 76 of file ApiResult.php.
Referenced by ApiExpandTemplates\execute(), ApiParse\execute(), ApiFormatXmlTest\provideGeneralEncoding(), ApiResultTest\provideTransformations(), ApiFormatXml\recXmlPrint(), ApiResultTest\testMetadata(), and ApiResultTest\testUtilityFunctions().
const ApiResult::META_TYPE = '_type' |
Key for the 'type' metadata item.
Value is one of the following strings:
Definition at line 108 of file ApiResult.php.
Referenced by addMetadataToResultVars(), ApiQuerySiteinfo\appendNamespaces(), ApiResultTest\customTransform(), ApiTokens\execute(), ApiQueryTokens\execute(), ApiQueryBlocks\execute(), ApiFormatXml\execute(), ApiQueryLogEvents\extractRowInfo(), ApiAuthManagerHelper\formatRequests(), ApiQueryImageInfo\getInfo(), ApiQueryUserInfo\getRateLimits(), LogFormatterTest\provideApiParamFormatting(), ApiFormatNoneTest\provideGeneralEncoding(), ApiFormatJsonTest\provideGeneralEncoding(), ApiFormatPhpTest\provideGeneralEncoding(), ApiFormatXmlTest\provideGeneralEncoding(), ApiResultTest\provideTransformations(), ApiFormatXml\recXmlPrint(), ApiQueryExtLinksUsage\run(), ApiQueryPagesWithProp\run(), ApiQueryCategoryMembers\run(), ApiQueryAllLinks\run(), ApiResultTest\testAddMetadataToResultVars(), ApiErrorFormatterTest\testErrorFormatter(), ApiErrorFormatterTest\testErrorFormatterBC(), ApiResultTest\testInstanceDataMethods(), ApiResultTest\testMetadata(), ApiResultTest\testObjectSerialization(), ApiResultTest\testStaticDataMethods(), and ApiResultTest\testUtilityFunctions().
const ApiResult::NO_SIZE_CHECK = 4 |
For addValue() and similar functions, do not check size while adding a value Don't use this unless you REALLY know what you're doing.
Values added while the size checking was disabled will never be counted. Ignored for setValue() and similar functions.
Definition at line 56 of file ApiResult.php.
Referenced by addParsedLimit(), addValue(), ApiErrorFormatter\addWarningOrError(), ApiErrorFormatter_BackCompat\addWarningOrError(), ApiQuery\doExport(), ApiHelp\execute(), ApiFormatXml\execute(), ApiQuery\execute(), removeValue(), ApiContinuationManager\setContinuationIntoResult(), ApiMain\setupExecuteAction(), ApiMain\substituteResultWithError(), ApiResultTest\testInstanceDataMethods(), and ApiResultTest\testStaticDataMethods().
const ApiResult::NO_VALIDATE = 12 |
For addValue(), setValue() and similar functions, do not validate data.
Also disables size checking. If you think you need to use this, you're probably wrong.
Definition at line 64 of file ApiResult.php.
Referenced by addValue(), ApiFormatFeedWrapper\setResult(), setValue(), ApiResultTest\testInstanceDataMethods(), and ApiResultTest\testStaticDataMethods().
const ApiResult::OVERRIDE = 1 |
Override existing value in addValue(), setValue(), and similar functions.
Definition at line 39 of file ApiResult.php.
Referenced by addParsedLimit(), ApiErrorFormatter_BackCompat\addWarningOrError(), ApiPageSet\populateGeneratorData(), setValue(), ApiResultTest\testInstanceDataMethods(), and ApiResultTest\testStaticDataMethods().