MediaWiki REL1_37
MediaWiki\Api\Validator\ApiParamValidatorCallbacks Class Reference

ParamValidator callbacks for the Action API. More...

Inheritance diagram for MediaWiki\Api\Validator\ApiParamValidatorCallbacks:
Collaboration diagram for MediaWiki\Api\Validator\ApiParamValidatorCallbacks:

Public Member Functions

 __construct (ApiMain $main)
 
 getUploadedFile ( $name, array $options)
 Fetch data for a file upload.
 
 getValue ( $name, $default, array $options)
 Fetch a value from the request.
 
 hasParam ( $name, array $options)
 Test if a parameter exists in the request.
 
 hasUpload ( $name, array $options)
 Test if a parameter exists as an upload in the request.
 
 recordCondition (DataMessageValue $message, $name, $value, array $settings, array $options)
 Record non-fatal conditions.
 
 useHighLimits (array $options)
 Indicate whether "high limits" should be used.
 

Private Attributes

ApiMain $apiMain
 
MessageConverter $messageConverter
 

Detailed Description

ParamValidator callbacks for the Action API.

Since
1.35

Definition at line 16 of file ApiParamValidatorCallbacks.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Api\Validator\ApiParamValidatorCallbacks::__construct ( ApiMain  $main)
Access: internal
Parameters
ApiMain$main

Definition at line 28 of file ApiParamValidatorCallbacks.php.

Member Function Documentation

◆ getUploadedFile()

MediaWiki\Api\Validator\ApiParamValidatorCallbacks::getUploadedFile (   $name,
array  $options 
)

Fetch data for a file upload.

Parameters
string$nameParameter name of the upload
array$optionsOptions array
Returns
UploadedFileInterface|null Uploaded file, or null if there is no file for $name.

Implements Wikimedia\ParamValidator\Callbacks.

Definition at line 67 of file ApiParamValidatorCallbacks.php.

Referenced by MediaWiki\Api\Validator\ApiParamValidatorCallbacks\hasUpload().

◆ getValue()

MediaWiki\Api\Validator\ApiParamValidatorCallbacks::getValue (   $name,
  $default,
array  $options 
)

Fetch a value from the request.

Return $default for file-upload parameters.

Parameters
string$nameParameter name to fetch
mixed$defaultDefault value to return if the parameter is unset.
array$optionsOptions array
Returns
string|string[]|mixed A string or string[] if the parameter was found, or $default if it was not.

Implements Wikimedia\ParamValidator\Callbacks.

Definition at line 37 of file ApiParamValidatorCallbacks.php.

◆ hasParam()

MediaWiki\Api\Validator\ApiParamValidatorCallbacks::hasParam (   $name,
array  $options 
)

Test if a parameter exists in the request.

Parameters
string$nameParameter name
array$optionsOptions array
Returns
bool True if present, false if absent. Return false for file upload parameters.

Implements Wikimedia\ParamValidator\Callbacks.

Definition at line 33 of file ApiParamValidatorCallbacks.php.

◆ hasUpload()

MediaWiki\Api\Validator\ApiParamValidatorCallbacks::hasUpload (   $name,
array  $options 
)

Test if a parameter exists as an upload in the request.

Parameters
string$nameParameter name
array$optionsOptions array
Returns
bool True if present, false if absent.

Implements Wikimedia\ParamValidator\Callbacks.

Definition at line 63 of file ApiParamValidatorCallbacks.php.

References MediaWiki\Api\Validator\ApiParamValidatorCallbacks\getUploadedFile().

◆ recordCondition()

MediaWiki\Api\Validator\ApiParamValidatorCallbacks::recordCondition ( DataMessageValue  $message,
  $name,
  $value,
array  $settings,
array  $options 
)

Record non-fatal conditions.

Parameters
DataMessageValue$messageFailure message
string$nameParameter name
mixed$valueParameter value
array$settingsParameter settings array
array$optionsOptions array

Implements Wikimedia\ParamValidator\Callbacks.

Definition at line 81 of file ApiParamValidatorCallbacks.php.

References Wikimedia\Message\DataMessageValue\getCode(), Wikimedia\Message\DataMessageValue\getData(), Wikimedia\Message\MessageValue\getKey(), and Wikimedia\Message\MessageValue\getParams().

◆ useHighLimits()

MediaWiki\Api\Validator\ApiParamValidatorCallbacks::useHighLimits ( array  $options)

Indicate whether "high limits" should be used.

Some settings have multiple limits, one for "normal" users and a higher one for "privileged" users. This is used to determine which class the current user is in when necessary.

Parameters
array$optionsOptions array
Returns
bool Whether the current user is privileged to use high limits

Implements Wikimedia\ParamValidator\Callbacks.

Definition at line 137 of file ApiParamValidatorCallbacks.php.

Member Data Documentation

◆ $apiMain

ApiMain MediaWiki\Api\Validator\ApiParamValidatorCallbacks::$apiMain
private

Definition at line 19 of file ApiParamValidatorCallbacks.php.

◆ $messageConverter

MessageConverter MediaWiki\Api\Validator\ApiParamValidatorCallbacks::$messageConverter
private

Definition at line 22 of file ApiParamValidatorCallbacks.php.


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