MediaWiki
1.34.0
|
Error reporting for ParamValidator. More...
Public Member Functions | |
__construct ( $name, $value, $settings, $code, $data, $previous=null) | |
getFailureCode () | |
Fetch the validation failure code. More... | |
getFailureData () | |
Fetch the validation failure data. More... | |
getParamName () | |
Fetch the parameter name that failed validation. More... | |
getParamValue () | |
Fetch the parameter value that failed validation. More... | |
getSettings () | |
Fetch the settings array that failed validation. More... | |
Protected Attributes | |
string | $failureCode |
string int string[][] | $failureData |
string | $paramName |
mixed | $paramValue |
array | $settings |
Static Private Member Functions | |
static | formatMessage ( $name, $code, $data) |
Make a simple English message for the exception. More... | |
Error reporting for ParamValidator.
Definition at line 15 of file ValidationException.php.
Wikimedia\ParamValidator\ValidationException::__construct | ( | $name, | |
$value, | |||
$settings, | |||
$code, | |||
$data, | |||
$previous = null |
|||
) |
string | $name | Parameter name being validated |
mixed | $value | Value of the parameter |
array | $settings | Settings array being used for validation |
string | $code | Failure code. See getFailureCode() for requirements. |
(string|int|string[])[] | $data Data for the failure code. See getFailureData() for requirements. | |
Throwable | Exception | null | $previous | Previous exception causing this failure |
Definition at line 41 of file ValidationException.php.
References Wikimedia\ParamValidator\ValidationException\$settings.
|
staticprivate |
Make a simple English message for the exception.
string | $name | |
string | $code | |
array | $data |
Definition at line 58 of file ValidationException.php.
Wikimedia\ParamValidator\ValidationException::getFailureCode | ( | ) |
Fetch the validation failure code.
A validation failure code is a reasonably short string matching the regex /^[a-z][a-z0-9-]*$/
.
Users are encouraged to use this with a suitable i18n mechanism rather than relying on the limited English text returned by getMessage().
Definition at line 104 of file ValidationException.php.
References Wikimedia\ParamValidator\ValidationException\$failureCode.
Referenced by MediaWiki\Rest\Validator\Validator\validateParams().
Wikimedia\ParamValidator\ValidationException::getFailureData | ( | ) |
Fetch the validation failure data.
This returns additional data relevant to the particular failure code.
Keys in the array are short ASCII strings. Values are strings or integers, or arrays of strings intended to be displayed as a comma-separated list. For any particular code the same keys are always returned in the same order, making it safe to use array_values() and access them positionally if that is desired.
For example, the data for a hypothetical "integer-out-of-range" code might have data ‘[ 'min’ => 0, 'max' => 100 ]` indicating the range of allowed values.
Definition at line 125 of file ValidationException.php.
References Wikimedia\ParamValidator\ValidationException\$failureData.
Referenced by MediaWiki\Rest\Validator\Validator\validateParams().
Wikimedia\ParamValidator\ValidationException::getParamName | ( | ) |
Fetch the parameter name that failed validation.
Definition at line 73 of file ValidationException.php.
References Wikimedia\ParamValidator\ValidationException\$paramName.
Referenced by MediaWiki\Rest\Validator\Validator\validateParams().
Wikimedia\ParamValidator\ValidationException::getParamValue | ( | ) |
Fetch the parameter value that failed validation.
Definition at line 81 of file ValidationException.php.
References Wikimedia\ParamValidator\ValidationException\$paramValue.
Referenced by MediaWiki\Rest\Validator\Validator\validateParams().
Wikimedia\ParamValidator\ValidationException::getSettings | ( | ) |
Fetch the settings array that failed validation.
Definition at line 89 of file ValidationException.php.
References Wikimedia\ParamValidator\ValidationException\$settings.
|
protected |
Definition at line 27 of file ValidationException.php.
Referenced by Wikimedia\ParamValidator\ValidationException\getFailureCode().
|
protected |
Definition at line 30 of file ValidationException.php.
Referenced by Wikimedia\ParamValidator\ValidationException\getFailureData().
|
protected |
Definition at line 18 of file ValidationException.php.
Referenced by Wikimedia\ParamValidator\ValidationException\getParamName().
|
protected |
Definition at line 21 of file ValidationException.php.
Referenced by Wikimedia\ParamValidator\ValidationException\getParamValue().
|
protected |
Definition at line 24 of file ValidationException.php.
Referenced by Wikimedia\ParamValidator\ValidationException\__construct(), and Wikimedia\ParamValidator\ValidationException\getSettings().