Wikibase
MediaWiki Wikibase extension
Wikibase\Repo\Validators\SnakValidator Class Reference
+ Inheritance diagram for Wikibase\Repo\Validators\SnakValidator:
+ Collaboration diagram for Wikibase\Repo\Validators\SnakValidator:

Public Member Functions

 __construct (PropertyDataTypeLookup $propertyDataTypeLookup, DataTypeFactory $dataTypeFactory, DataTypeValidatorFactory $validatorFactory)
 
 validateClaimSnaks (Statement $statement)
 Applies validation to the given Claim. More...
 
 validateReferences (ReferenceList $references)
 Validate a list of references. More...
 
 validateReference (Reference $reference)
 Validate a list of references. More...
 
 validate ( $snak)
 Validates a Snak. More...
 
 validateDataValue (DataValue $dataValue, $dataTypeId)
 Validates the given data value using the given data type. More...
 
 setOptions (array $options)
 

Private Attributes

 $dataTypeFactory
 
 $propertyDataTypeLookup
 
 $validatorFactory
 

Detailed Description

Author
Daniel Kinzler

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Repo\Validators\SnakValidator::__construct ( PropertyDataTypeLookup  $propertyDataTypeLookup,
DataTypeFactory  $dataTypeFactory,
DataTypeValidatorFactory  $validatorFactory 
)

Member Function Documentation

◆ setOptions()

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

◆ validate()

Wikibase\Repo\Validators\SnakValidator::validate (   $snak)

Validates a Snak.

For a PropertyValueSnak, this is done using the validators from the DataType that is associated with the Snak's property. Other Snak types are currently not validated.

See also
ValueValidator::validate()
Parameters
Snak$snakThe value to validate
Exceptions
InvalidArgumentException
Returns
Result

◆ validateClaimSnaks()

Wikibase\Repo\Validators\SnakValidator::validateClaimSnaks ( Statement  $statement)

Applies validation to the given Claim.

This is done by validating all snaks contained in the claim, notably: the main snak, the qualifiers, and all snaks of all references, in case the claim is a Statement.

Parameters
Statement$statementThe value to validate
Returns
Result

◆ validateDataValue()

Wikibase\Repo\Validators\SnakValidator::validateDataValue ( DataValue  $dataValue,
  $dataTypeId 
)

Validates the given data value using the given data type.

Parameters
DataValue$dataValue
string$dataTypeId
Returns
Result

◆ validateReference()

Wikibase\Repo\Validators\SnakValidator::validateReference ( Reference  $reference)

Validate a list of references.

This is done by validating all snaks in all of the references.

Parameters
Reference$reference
Returns
Result

◆ validateReferences()

Wikibase\Repo\Validators\SnakValidator::validateReferences ( ReferenceList  $references)

Validate a list of references.

This is done by validating all snaks in all of the references.

Parameters
ReferenceList$references
Returns
Result

Member Data Documentation

◆ $dataTypeFactory

Wikibase\Repo\Validators\SnakValidator::$dataTypeFactory
private

◆ $propertyDataTypeLookup

Wikibase\Repo\Validators\SnakValidator::$propertyDataTypeLookup
private

◆ $validatorFactory

Wikibase\Repo\Validators\SnakValidator::$validatorFactory
private

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