Wikibase
MediaWiki Wikibase extension
Wikibase\Repo\ValidatorBuilders Class Reference

Defines validators for the basic well known data types supported by Wikibase. More...

Public Member Functions

 __construct (EntityLookup $lookup, EntityIdParser $idParser, array $urlSchemes, $itemVocabularyBaseUri, ContentLanguages $contentLanguages, CachingCommonsMediaFileNameLookup $cachingCommonsMediaFileNameLookup, MediaWikiPageNameNormalizer $mediaWikiPageNameNormalizer, $geoShapeStorageApiUrl, $tabularDataStorageApiUrl)
 
 buildItemValidators ()
 
 buildPropertyValidators ()
 
 buildEntityValidators ()
 
 getEntityValidators ( $entityType=null)
 
 buildMediaValidators ( $checkExistence='checkExistence')
 
 buildGeoShapeValidators ( $checkExistence='checkExistence')
 
 buildTabularDataValidators ( $checkExistence='checkExistence')
 
 buildEntitySchemaValidators ()
 
 buildStringValidators ( $maxLength=400)
 
 buildMonolingualTextValidators ( $maxLength=400)
 
 buildTimeValidators ()
 
 buildCoordinateValidators ()
 
 buildUrlValidators ( $maxLength=500)
 
 buildQuantityValidators ()
 

Private Member Functions

 getCommonStringValidators ( $maxLength=400)
 
 getUrlValidator (array $urlSchemes, $prefix=null, $maxLength=500)
 
 getPrefixValidator ( $prefix, $errorCode)
 

Private Attributes

 $entityLookup
 
 $entityIdParser
 
 $urlSchemes
 
 $itemVocabularyBaseUri
 
 $wikidataBaseUri = 'http://www.wikidata.org/entity/'
 
 $contentLanguages
 
 $mediaFileNameLookup
 
 $mediaWikiPageNameNormalizer
 
 $geoShapeStorageApiUrl
 
 $tabularDataStorageApiUrl
 

Detailed Description

Defines validators for the basic well known data types supported by Wikibase.

Warning
: This is a low level factory for use by bootstrap code only! Program logic should use an instance of DataTypeValidatorFactory.
Author
Daniel Kinzler

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Repo\ValidatorBuilders::__construct ( EntityLookup  $lookup,
EntityIdParser  $idParser,
array  $urlSchemes,
  $itemVocabularyBaseUri,
ContentLanguages  $contentLanguages,
CachingCommonsMediaFileNameLookup  $cachingCommonsMediaFileNameLookup,
MediaWikiPageNameNormalizer  $mediaWikiPageNameNormalizer,
  $geoShapeStorageApiUrl,
  $tabularDataStorageApiUrl 
)
Parameters
EntityLookup$lookup
EntityIdParser$idParser
string[]$urlSchemes
string$itemVocabularyBaseUriThe base URI for vocabulary concepts.
ContentLanguages$contentLanguages
CachingCommonsMediaFileNameLookup$cachingCommonsMediaFileNameLookup
MediaWikiPageNameNormalizer$mediaWikiPageNameNormalizer
string$geoShapeStorageApiUrl
string$tabularDataStorageApiUrl

Member Function Documentation

◆ buildCoordinateValidators()

Wikibase\Repo\ValidatorBuilders::buildCoordinateValidators ( )
Returns
ValueValidator[]

◆ buildEntitySchemaValidators()

Wikibase\Repo\ValidatorBuilders::buildEntitySchemaValidators ( )
Returns
ValueValidator[]

◆ buildEntityValidators()

Wikibase\Repo\ValidatorBuilders::buildEntityValidators ( )
Returns
ValueValidator[]

◆ buildGeoShapeValidators()

Wikibase\Repo\ValidatorBuilders::buildGeoShapeValidators (   $checkExistence = 'checkExistence')
Parameters
string$checkExistenceEither 'checkExistence' or 'doNotCheckExistence'
Returns
ValueValidator[]

◆ buildItemValidators()

Wikibase\Repo\ValidatorBuilders::buildItemValidators ( )
Returns
ValueValidator[]

◆ buildMediaValidators()

Wikibase\Repo\ValidatorBuilders::buildMediaValidators (   $checkExistence = 'checkExistence')
Parameters
string$checkExistenceEither 'checkExistence' or 'doNotCheckExistence'
Returns
ValueValidator[]

◆ buildMonolingualTextValidators()

Wikibase\Repo\ValidatorBuilders::buildMonolingualTextValidators (   $maxLength = 400)
Parameters
int$maxLengthDefaults to 400 characters. This was an arbitrary decision and simply copied the default of the CommonStringValidators
Returns
ValueValidator[]

◆ buildPropertyValidators()

Wikibase\Repo\ValidatorBuilders::buildPropertyValidators ( )
Returns
ValueValidator[]

◆ buildQuantityValidators()

Wikibase\Repo\ValidatorBuilders::buildQuantityValidators ( )
Returns
ValueValidator[]

◆ buildStringValidators()

Wikibase\Repo\ValidatorBuilders::buildStringValidators (   $maxLength = 400)
Parameters
int$maxLength
Returns
ValueValidator[]

◆ buildTabularDataValidators()

Wikibase\Repo\ValidatorBuilders::buildTabularDataValidators (   $checkExistence = 'checkExistence')
Parameters
string$checkExistenceEither 'checkExistence' or 'doNotCheckExistence'
Returns
ValueValidator[]

◆ buildTimeValidators()

Wikibase\Repo\ValidatorBuilders::buildTimeValidators ( )
Returns
ValueValidator[]

◆ buildUrlValidators()

Wikibase\Repo\ValidatorBuilders::buildUrlValidators (   $maxLength = 500)
Parameters
int$maxLength
Returns
ValueValidator[]

◆ getCommonStringValidators()

Wikibase\Repo\ValidatorBuilders::getCommonStringValidators (   $maxLength = 400)
private
Parameters
int$maxLengthDefaults to 400 characters. This was an arbitrary decision when it turned out that 255 was to short for descriptions.
Returns
ValueValidator[]

◆ getEntityValidators()

Wikibase\Repo\ValidatorBuilders::getEntityValidators (   $entityType = null)
Parameters
string | null$entityType
Returns
ValueValidator[]

◆ getPrefixValidator()

Wikibase\Repo\ValidatorBuilders::getPrefixValidator (   $prefix,
  $errorCode 
)
private
Parameters
string$prefix
string$errorCode
Returns
RegexValidator

◆ getUrlValidator()

Wikibase\Repo\ValidatorBuilders::getUrlValidator ( array  $urlSchemes,
  $prefix = null,
  $maxLength = 500 
)
private
Parameters
string[]$urlSchemesList of URL schemes, e.g. 'http'
string | null$prefixa required prefix
int$maxLengthDefaults to 500 characters. Even if URLs are unlimited in theory they should be limited to about 2000. About 500 is a reasonable compromise.
See also
http://stackoverflow.com/a/417184
Returns
CompositeValidator

Member Data Documentation

◆ $contentLanguages

Wikibase\Repo\ValidatorBuilders::$contentLanguages
private

◆ $entityIdParser

Wikibase\Repo\ValidatorBuilders::$entityIdParser
private

◆ $entityLookup

Wikibase\Repo\ValidatorBuilders::$entityLookup
private

◆ $geoShapeStorageApiUrl

Wikibase\Repo\ValidatorBuilders::$geoShapeStorageApiUrl
private

◆ $itemVocabularyBaseUri

Wikibase\Repo\ValidatorBuilders::$itemVocabularyBaseUri
private

◆ $mediaFileNameLookup

Wikibase\Repo\ValidatorBuilders::$mediaFileNameLookup
private

◆ $mediaWikiPageNameNormalizer

Wikibase\Repo\ValidatorBuilders::$mediaWikiPageNameNormalizer
private

◆ $tabularDataStorageApiUrl

Wikibase\Repo\ValidatorBuilders::$tabularDataStorageApiUrl
private

◆ $urlSchemes

Wikibase\Repo\ValidatorBuilders::$urlSchemes
private

◆ $wikidataBaseUri

Wikibase\Repo\ValidatorBuilders::$wikidataBaseUri = 'http://www.wikidata.org/entity/'
private

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