Wikibase
MediaWiki Wikibase extension
Wikibase\Repo\Validators\NotEntityIdValidator Class Reference

Validator for checking that a given string is NOT an EntityId. More...

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

Public Member Functions

 __construct (EntityIdParser $idParser, $errorCode, array $forbiddenTypes=null)
 
 validate ( $value)
 
 setOptions (array $options)
 

Private Attributes

 $idParser
 
 $errorCode
 
 $forbiddenTypes
 

Detailed Description

Validator for checking that a given string is NOT an EntityId.

Useful e.g. for preventing property labels that "look like" property IDs.

Author
Daniel Kinzler

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Repo\Validators\NotEntityIdValidator::__construct ( EntityIdParser  $idParser,
  $errorCode,
array  $forbiddenTypes = null 
)
Parameters
EntityIdParser$idParserThe parser to use for testing whether a string is an entity ID.
string$errorCodeThe error code to use when this validator fails.
string[] | null$forbiddenTypesA list of entity types who's IDs should be considered invalid values. If null, all valid entity IDs are considered invalid input.
Exceptions
InvalidArgumentException

Member Function Documentation

◆ setOptions()

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

◆ validate()

Wikibase\Repo\Validators\NotEntityIdValidator::validate (   $value)
See also
ValueValidator::validate()
Parameters
string$valueThe value to validate
Returns
Result

Member Data Documentation

◆ $errorCode

Wikibase\Repo\Validators\NotEntityIdValidator::$errorCode
private

◆ $forbiddenTypes

Wikibase\Repo\Validators\NotEntityIdValidator::$forbiddenTypes
private

◆ $idParser

Wikibase\Repo\Validators\NotEntityIdValidator::$idParser
private

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