Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\Lib\Store\EntityNamespaceLookup Class Reference

Utility functions for Wikibase namespaces. More...

Public Member Functions

 __construct (array $entityNamespaces, array $entitySlots=[])
 
 getEntityNamespaces ()
 Returns a list of entity types pointing to the ids of the namespaces in which they reside.
 
 getEntitySlots ()
 
 getEntityNamespace ( $entityType)
 
 getEntitySlotRole ( $entityType)
 
 isNamespaceWithEntities ( $ns)
 Determines whether the given namespace contains some kind of Wikibase entity.
 
 isEntityNamespace ( $ns)
 Determines whether the given namespace is reserved for holding some kind of Wikibase entity.
 
 getEntityType ( $ns)
 
 merge (EntityNamespaceLookup $nsLookup)
 

Private Attributes

 $entityNamespaces
 
 $entitySlots
 

Detailed Description

Utility functions for Wikibase namespaces.

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Lib\Store\EntityNamespaceLookup::__construct ( array $entityNamespaces,
array $entitySlots = [] )
Parameters
int[]$entityNamespaces
string[]$entitySlots

Member Function Documentation

◆ getEntityNamespace()

Wikibase\Lib\Store\EntityNamespaceLookup::getEntityNamespace ( $entityType)
Parameters
string$entityType
Returns
int|null The namespace ID number associated with the given entity type, or null if $entityType is not a know entity type identifier.

◆ getEntityNamespaces()

Wikibase\Lib\Store\EntityNamespaceLookup::getEntityNamespaces ( )

Returns a list of entity types pointing to the ids of the namespaces in which they reside.

Returns
int[] Array mapping entity type strings to namespace IDs

◆ getEntitySlotRole()

Wikibase\Lib\Store\EntityNamespaceLookup::getEntitySlotRole ( $entityType)
Parameters
string$entityType
Returns
string The role name of the slot that this kind of entity is stored in. In dedicated entity namespaces, this will be the "main" slot, but other slots may be used when entities are "attached" to other kinds of pages.

◆ getEntitySlots()

Wikibase\Lib\Store\EntityNamespaceLookup::getEntitySlots ( )
Returns
string[]

◆ getEntityType()

Wikibase\Lib\Store\EntityNamespaceLookup::getEntityType ( $ns)
Parameters
int$ns
Returns
string|null

◆ isEntityNamespace()

Wikibase\Lib\Store\EntityNamespaceLookup::isEntityNamespace ( $ns)

Determines whether the given namespace is reserved for holding some kind of Wikibase entity.

Note that this will return only if the namespace contains entities in the page's main slots. When other slots are used to "attach" entities to other kind of content, this returns false.

See also
isNamespaceWithEntities()
Parameters
int$nsthe namespace ID
Returns
bool true if $ns is an entity namespace

◆ isNamespaceWithEntities()

Wikibase\Lib\Store\EntityNamespaceLookup::isNamespaceWithEntities ( $ns)

Determines whether the given namespace contains some kind of Wikibase entity.

This will return true if pages in this namespace may contain entities in any slot.

See also
isEntityNamespace()
Parameters
int$nsthe namespace ID
Returns
bool true if $ns is an entity namespace

◆ merge()

Wikibase\Lib\Store\EntityNamespaceLookup::merge ( EntityNamespaceLookup $nsLookup)
Parameters
EntityNamespaceLookup$nsLookup
Returns
EntityNamespaceLookup

Member Data Documentation

◆ $entityNamespaces

Wikibase\Lib\Store\EntityNamespaceLookup::$entityNamespaces
private

◆ $entitySlots

Wikibase\Lib\Store\EntityNamespaceLookup::$entitySlots
private

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