Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\Repo\Validators\DataFieldValidator Class Reference

The DataFieldValidator class allows the validation of a single field of a complex DataValues object based on the DataValue's array representation. More...

+ Inheritance diagram for Wikibase\Repo\Validators\DataFieldValidator:
+ Collaboration diagram for Wikibase\Repo\Validators\DataFieldValidator:

Public Member Functions

 __construct ( $field, ValueValidator $validator)
 
 validate ( $data)
 
 setOptions (array $options)
 

Private Attributes

 $field
 
 $validator
 

Detailed Description

The DataFieldValidator class allows the validation of a single field of a complex DataValues object based on the DataValue's array representation.

If the respective field is missing or null, the validation will fail with the code 'missing-field'

Author
Daniel Kinzler

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Repo\Validators\DataFieldValidator::__construct (   $field,
ValueValidator  $validator 
)
Parameters
string | int$fieldThe field on the target DataValue's array representation to check
ValueValidator$validatorThe validator to apply to the given field
Exceptions
InvalidArgumentException

Member Function Documentation

◆ setOptions()

Wikibase\Repo\Validators\DataFieldValidator::setOptions ( array  $options)
See also
ValueValidator::setOptions()
Parameters
array$options

◆ validate()

Wikibase\Repo\Validators\DataFieldValidator::validate (   $data)
See also
ValueValidator::validate()
Parameters
array$dataThe data array to validate
Returns
Result
Exceptions
InvalidArgumentException

Member Data Documentation

◆ $field

Wikibase\Repo\Validators\DataFieldValidator::$field
private

◆ $validator

Wikibase\Repo\Validators\DataFieldValidator::$validator
private

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