MediaWiki master
Wikimedia\ParamValidator\SimpleCallbacks Class Reference

Simple Callbacks implementation for $_GET/$_POST/$_FILES data. More...

Inherits Wikimedia\ParamValidator\Callbacks.

Collaboration diagram for Wikimedia\ParamValidator\SimpleCallbacks:

Public Member Functions

 __construct (array $params, array $files=[])
 
 clearRecordedConditions ()
 Clear any recorded conditions.
 
 getRecordedConditions ()
 Fetch any recorded conditions.
 
 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.

 
 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.

 
 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.

 
 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.

 
 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

 
 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

 

Detailed Description

Simple Callbacks implementation for $_GET/$_POST/$_FILES data.

Options array keys used by this class:

  • 'useHighLimits': (bool) Return value from useHighLimits()
Since
1.34
Stability: unstable

Definition at line 17 of file SimpleCallbacks.php.

Constructor & Destructor Documentation

◆ __construct()

Wikimedia\ParamValidator\SimpleCallbacks::__construct ( array $params,
array $files = [] )
Parameters
(string|string[])[]$params Data from $_POST + $_GET
array[]$filesData from $_FILES

Definition at line 32 of file SimpleCallbacks.php.

Member Function Documentation

◆ clearRecordedConditions()

Wikimedia\ParamValidator\SimpleCallbacks::clearRecordedConditions ( )

Clear any recorded conditions.

Definition at line 86 of file SimpleCallbacks.php.

◆ getRecordedConditions()

Wikimedia\ParamValidator\SimpleCallbacks::getRecordedConditions ( )

Fetch any recorded conditions.

Returns
array[]

Definition at line 79 of file SimpleCallbacks.php.

◆ getUploadedFile()

Wikimedia\ParamValidator\SimpleCallbacks::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 53 of file SimpleCallbacks.php.

◆ getValue()

Wikimedia\ParamValidator\SimpleCallbacks::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 43 of file SimpleCallbacks.php.

◆ hasParam()

Wikimedia\ParamValidator\SimpleCallbacks::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 38 of file SimpleCallbacks.php.

◆ hasUpload()

Wikimedia\ParamValidator\SimpleCallbacks::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 48 of file SimpleCallbacks.php.

◆ recordCondition()

Wikimedia\ParamValidator\SimpleCallbacks::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 64 of file SimpleCallbacks.php.

◆ useHighLimits()

Wikimedia\ParamValidator\SimpleCallbacks::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 91 of file SimpleCallbacks.php.


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