Wikibase
MediaWiki Wikibase extension
Wikibase\Client\DataAccess\Scribunto\EntityAccessor Class Reference

Functionality needed to expose Entities to Lua. More...

Public Member Functions

 __construct (EntityIdParser $entityIdParser, EntityLookup $entityLookup, UsageAccumulator $usageAccumulator, Serializer $entitySerializer, Serializer $statementSerializer, PropertyDataTypeLookup $dataTypeLookup, TermLanguageFallbackChain $termFallbackChain, Language $language, ContentLanguages $termsLanguages, LoggerInterface $logger=null)
 
 getEntity ( $prefixedEntityId)
 Get entity from prefixed ID (e.g. More...
 
 entityExists ( $prefixedEntityId)
 Find out whether an entity exists. More...
 
 getEntityStatements ( $prefixedEntityId, $propertyIdSerialization, $rank)
 Get statement list from prefixed ID (e.g. More...
 

Private Member Functions

 renumber (array &$entityArr)
 Recursively renumber a serialized array in place, so it is indexed at 1, not 0. More...
 
 newClientEntitySerializer ()
 
 newClientStatementListSerializer ()
 
 logPossibleDoubleRedirect ( $prefixedEntityId)
 

Private Attributes

 $entityIdParser
 
 $entityLookup
 
 $usageAccumulator
 
 $entitySerializer
 
 $statementSerializer
 
 $dataTypeLookup
 
 $termFallbackChain
 
 $language
 
 $termsLanguages
 
 $logger
 

Detailed Description

Functionality needed to expose Entities to Lua.

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Client\DataAccess\Scribunto\EntityAccessor::__construct ( EntityIdParser  $entityIdParser,
EntityLookup  $entityLookup,
UsageAccumulator  $usageAccumulator,
Serializer  $entitySerializer,
Serializer  $statementSerializer,
PropertyDataTypeLookup  $dataTypeLookup,
TermLanguageFallbackChain  $termFallbackChain,
Language  $language,
ContentLanguages  $termsLanguages,
LoggerInterface  $logger = null 
)
Parameters
EntityIdParser$entityIdParser
EntityLookup$entityLookup
UsageAccumulator$usageAccumulator
Serializer$entitySerializer
Serializer$statementSerializer
PropertyDataTypeLookup$dataTypeLookup
TermLanguageFallbackChain$termFallbackChain
Language$language
ContentLanguages$termsLanguages

Member Function Documentation

◆ entityExists()

Wikibase\Client\DataAccess\Scribunto\EntityAccessor::entityExists (   $prefixedEntityId)

Find out whether an entity exists.

Parameters
string$prefixedEntityId
Returns
bool

◆ getEntity()

Wikibase\Client\DataAccess\Scribunto\EntityAccessor::getEntity (   $prefixedEntityId)

Get entity from prefixed ID (e.g.

"Q23") and return it as serialized array.

Parameters
string$prefixedEntityId
Returns
array|null

◆ getEntityStatements()

Wikibase\Client\DataAccess\Scribunto\EntityAccessor::getEntityStatements (   $prefixedEntityId,
  $propertyIdSerialization,
  $rank 
)

Get statement list from prefixed ID (e.g.

"Q23") and property (e.g "P123") and return it as serialized array.

Parameters
string$prefixedEntityId
string$propertyIdSerialization
string$rankWhich statements to include. Either "best" or "all".
Returns
array|null

◆ logPossibleDoubleRedirect()

Wikibase\Client\DataAccess\Scribunto\EntityAccessor::logPossibleDoubleRedirect (   $prefixedEntityId)
private
See also
UnresolvedEntityRedirectException
Parameters
$prefixedEntityId

◆ newClientEntitySerializer()

Wikibase\Client\DataAccess\Scribunto\EntityAccessor::newClientEntitySerializer ( )
private

◆ newClientStatementListSerializer()

Wikibase\Client\DataAccess\Scribunto\EntityAccessor::newClientStatementListSerializer ( )
private

◆ renumber()

Wikibase\Client\DataAccess\Scribunto\EntityAccessor::renumber ( array &  $entityArr)
private

Recursively renumber a serialized array in place, so it is indexed at 1, not 0.

Just like Lua wants it.

Parameters
array&$entityArr

Member Data Documentation

◆ $dataTypeLookup

Wikibase\Client\DataAccess\Scribunto\EntityAccessor::$dataTypeLookup
private

◆ $entityIdParser

Wikibase\Client\DataAccess\Scribunto\EntityAccessor::$entityIdParser
private

◆ $entityLookup

Wikibase\Client\DataAccess\Scribunto\EntityAccessor::$entityLookup
private

◆ $entitySerializer

Wikibase\Client\DataAccess\Scribunto\EntityAccessor::$entitySerializer
private

◆ $language

Wikibase\Client\DataAccess\Scribunto\EntityAccessor::$language
private

◆ $logger

Wikibase\Client\DataAccess\Scribunto\EntityAccessor::$logger
private

◆ $statementSerializer

Wikibase\Client\DataAccess\Scribunto\EntityAccessor::$statementSerializer
private

◆ $termFallbackChain

Wikibase\Client\DataAccess\Scribunto\EntityAccessor::$termFallbackChain
private

◆ $termsLanguages

Wikibase\Client\DataAccess\Scribunto\EntityAccessor::$termsLanguages
private

◆ $usageAccumulator

Wikibase\Client\DataAccess\Scribunto\EntityAccessor::$usageAccumulator
private

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