MembershipValidator checks that a value is in a fixed set of allowed values.
More...
MembershipValidator checks that a value is in a fixed set of allowed values.
- Copyright
- GPL-2.0-or-later
- Author
- Daniel Kinzler
◆ __construct()
Wikibase\Repo\Validators\MembershipValidator::__construct |
( |
array |
$allowed, |
|
|
|
$errorCode = 'not-allowed' , |
|
|
|
$normalizer = null |
|
) |
| |
- Parameters
-
string[] | $allowed | The allowed values |
string | $errorCode | Code to use in Errors; should indicate what kind of value would have been allowed. |
callable | string | null | $normalizer | An optional function to normalize the value before comparing it to the list of allowed values, e.g. 'strtolower'. |
- Exceptions
-
◆ setOptions()
Wikibase\Repo\Validators\MembershipValidator::setOptions |
( |
array |
$options | ) |
|
- See also
- ValueValidator::setOptions
- Parameters
-
◆ validate()
Wikibase\Repo\Validators\MembershipValidator::validate |
( |
|
$value | ) |
|
- See also
- ValueValidator::validate
- Parameters
-
string | $value | The value to validate |
- Returns
- Result
◆ $allowed
Wikibase\Repo\Validators\MembershipValidator::$allowed |
|
private |
◆ $errorCode
Wikibase\Repo\Validators\MembershipValidator::$errorCode |
|
private |
◆ $normalizer
Wikibase\Repo\Validators\MembershipValidator::$normalizer |
|
private |
The documentation for this class was generated from the following file: