MediaWiki  1.34.4
Wikimedia\ParamValidator\TypeDef\LimitDef Class Reference

Type definition for "limit" types. More...

Inheritance diagram for Wikimedia\ParamValidator\TypeDef\LimitDef:
Collaboration diagram for Wikimedia\ParamValidator\TypeDef\LimitDef:

Public Member Functions

 normalizeSettings (array $settings)
 Normalize a settings array. More...
 
 validate ( $name, $value, array $settings, array $options)
 Validate the value.When ParamValidator is processing a multi-valued parameter, this will be called once for each of the supplied values. Which may mean zero calls.When getValue() returned null, this will not be called.
Parameters
string$nameParameter name being validated.
mixed$valueValue to validate, from getValue().
array$settingsParameter settings array.
array$optionsOptions array. Note the following values that may be set by ParamValidator:
  • values-list: (string[]) If defined, values of a multi-valued parameter are being processed (and this array holds the full set of values).
Returns
mixed Validated value
Exceptions
ValidationExceptionif the value is invalid
More...
 
- Public Member Functions inherited from Wikimedia\ParamValidator\TypeDef\IntegerDef
 describeSettings ( $name, array $settings, array $options)
 "Describe" a settings array More...
 
- Public Member Functions inherited from Wikimedia\ParamValidator\TypeDef
 __construct (Callbacks $callbacks)
 
 getEnumValues ( $name, array $settings, array $options)
 Get the values for enum-like parameters. More...
 
 getValue ( $name, array $settings, array $options)
 Get the value from the request. More...
 
 stringifyValue ( $name, $value, array $settings, array $options)
 Convert a value to a string representation. More...
 

Additional Inherited Members

- Public Attributes inherited from Wikimedia\ParamValidator\TypeDef\IntegerDef
const PARAM_IGNORE_RANGE = 'param-ignore-range'
 (bool) Whether to enforce the specified range. More...
 
const PARAM_MAX = 'param-max'
 (int) Maximum allowed value (normal limits) More...
 
const PARAM_MAX2 = 'param-max2'
 (int) Maximum allowed value (high limits) More...
 
const PARAM_MIN = 'param-min'
 (int) Minimum allowed value. More...
 
- Protected Attributes inherited from Wikimedia\ParamValidator\TypeDef
Callbacks $callbacks
 

Detailed Description

Type definition for "limit" types.

A limit type is an integer type that also accepts the magic value "max". IntegerDef::PARAM_MIN defaults to 0 for this type.

See also
IntegerDef
Since
1.34 @unstable

Definition at line 15 of file LimitDef.php.

Member Function Documentation

◆ normalizeSettings()

Wikimedia\ParamValidator\TypeDef\LimitDef::normalizeSettings ( array  $settings)

Normalize a settings array.

Parameters
array$settings
Returns
array

Reimplemented from Wikimedia\ParamValidator\TypeDef\IntegerDef.

Definition at line 37 of file LimitDef.php.

◆ validate()

Wikimedia\ParamValidator\TypeDef\LimitDef::validate (   $name,
  $value,
array  $settings,
array  $options 
)

Validate the value.When ParamValidator is processing a multi-valued parameter, this will be called once for each of the supplied values. Which may mean zero calls.When getValue() returned null, this will not be called.

Parameters
string$nameParameter name being validated.
mixed$valueValue to validate, from getValue().
array$settingsParameter settings array.
array$optionsOptions array. Note the following values that may be set by ParamValidator:
  • values-list: (string[]) If defined, values of a multi-valued parameter are being processed (and this array holds the full set of values).
Returns
mixed Validated value
Exceptions
ValidationExceptionif the value is invalid

Additional $options accepted:

  • 'parse-limit': (bool) Default true, set false to return 'max' rather than determining the effective value.

Reimplemented from Wikimedia\ParamValidator\TypeDef\IntegerDef.

Definition at line 24 of file LimitDef.php.

References Wikimedia\ParamValidator\TypeDef\IntegerDef\PARAM_MAX, and Wikimedia\ParamValidator\TypeDef\IntegerDef\PARAM_MAX2.


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