MediaWiki  master
MediaWiki\Rest\Validator\ParamValidatorCallbacks Class Reference
Inheritance diagram for MediaWiki\Rest\Validator\ParamValidatorCallbacks:
Collaboration diagram for MediaWiki\Rest\Validator\ParamValidatorCallbacks:

Public Member Functions

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

Private Member Functions

 getParamsFromSource ( $source)
 Get the raw parameters from a source in the request. More...
 

Private Attributes

Authority $authority
 
RequestInterface $request
 

Detailed Description

Definition at line 12 of file ParamValidatorCallbacks.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Rest\Validator\ParamValidatorCallbacks::__construct ( RequestInterface  $request,
Authority  $authority 
)

Member Function Documentation

◆ getParamsFromSource()

MediaWiki\Rest\Validator\ParamValidatorCallbacks::getParamsFromSource (   $source)
private

Get the raw parameters from a source in the request.

Parameters
string$source'path', 'query', or 'post'
Returns
array

Definition at line 33 of file ParamValidatorCallbacks.php.

References $source.

Referenced by MediaWiki\Rest\Validator\ParamValidatorCallbacks\getValue(), and MediaWiki\Rest\Validator\ParamValidatorCallbacks\hasParam().

◆ getUploadedFile()

MediaWiki\Rest\Validator\ParamValidatorCallbacks::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 69 of file ParamValidatorCallbacks.php.

Referenced by MediaWiki\Rest\Validator\ParamValidatorCallbacks\hasUpload().

◆ getValue()

MediaWiki\Rest\Validator\ParamValidatorCallbacks::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 54 of file ParamValidatorCallbacks.php.

References MediaWiki\Rest\Validator\ParamValidatorCallbacks\getParamsFromSource().

◆ hasParam()

MediaWiki\Rest\Validator\ParamValidatorCallbacks::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 49 of file ParamValidatorCallbacks.php.

References MediaWiki\Rest\Validator\ParamValidatorCallbacks\getParamsFromSource().

◆ hasUpload()

MediaWiki\Rest\Validator\ParamValidatorCallbacks::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 62 of file ParamValidatorCallbacks.php.

References MediaWiki\Rest\Validator\ParamValidatorCallbacks\getUploadedFile().

◆ recordCondition()

MediaWiki\Rest\Validator\ParamValidatorCallbacks::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 77 of file ParamValidatorCallbacks.php.

◆ useHighLimits()

MediaWiki\Rest\Validator\ParamValidatorCallbacks::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 83 of file ParamValidatorCallbacks.php.

Member Data Documentation

◆ $authority

Authority MediaWiki\Rest\Validator\ParamValidatorCallbacks::$authority
private

◆ $request

RequestInterface MediaWiki\Rest\Validator\ParamValidatorCallbacks::$request
private

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