Wikibase
MediaWiki Wikibase extension
Wikibase\Lib\Store\HashSiteLinkStore Class Reference

An array based dummy implementation of a SiteLinkStore for exclusive use in tests. More...

+ Inheritance diagram for Wikibase\Lib\Store\HashSiteLinkStore:
+ Collaboration diagram for Wikibase\Lib\Store\HashSiteLinkStore:

Public Member Functions

 getItemIdForLink ( $globalSiteId, $pageTitle)
 
 getSiteLinksForItem (ItemId $itemId)
 
 getItemIdForSiteLink (SiteLink $siteLink)
 
 saveLinksOfItem (Item $item)
 
 deleteLinksOfItem (ItemId $itemId)
 See SiteLinkStore::deleteLinksOfItem. More...
 
 clear ()
 Clears all sitelinks from the cache.
Returns
bool Success indicator
More...
 
 getEntityIdForLinkedTitle ( $globalSiteId, $pageTitle)
 
- Public Member Functions inherited from Wikibase\Lib\Store\SiteLinkLookup
 getLinks (array $numericIds=[], array $siteIds=[], array $pageNames=[])
 Returns the links that match the provided conditions. More...
 

Private Member Functions

 linkMatches (ItemId $itemId, SiteLink $siteLink, array $numericIds, array $siteIds, array $pageNames)
 Returns true if the link matches the given conditions. More...
 
 indexByLink (ItemId $itemId, SiteLink $siteLink)
 
 indexByItemId (ItemId $itemId, SiteLink $siteLink)
 
 makeSiteLinkKey (SiteLink $siteLink)
 

Private Attributes

 $linksByItemId = []
 
 $itemIdsByLink = []
 

Detailed Description

An array based dummy implementation of a SiteLinkStore for exclusive use in tests.

Todo:
Should be moved to the tests folder and namespace.
Author
Katie Filbert < aude..nosp@m.wiki.nosp@m.@gmai.nosp@m.l.co.nosp@m.m >

Member Function Documentation

◆ clear()

Wikibase\Lib\Store\HashSiteLinkStore::clear ( )

Clears all sitelinks from the cache.

Returns
bool Success indicator

Implements Wikibase\Lib\Store\SiteLinkStore.

◆ deleteLinksOfItem()

Wikibase\Lib\Store\HashSiteLinkStore::deleteLinksOfItem ( ItemId  $itemId)

See SiteLinkStore::deleteLinksOfItem.

Parameters
ItemId$itemId
Returns
bool

Implements Wikibase\Lib\Store\SiteLinkStore.

◆ getEntityIdForLinkedTitle()

Wikibase\Lib\Store\HashSiteLinkStore::getEntityIdForLinkedTitle (   $globalSiteId,
  $pageTitle 
)
Parameters
string$globalSiteId
string$pageTitle
Exceptions
InvalidArgumentExceptionif a parameter does not have the expected type
Returns
EntityId|null

Implements Wikibase\Lib\Store\EntityByLinkedTitleLookup.

◆ getItemIdForLink()

Wikibase\Lib\Store\HashSiteLinkStore::getItemIdForLink (   $globalSiteId,
  $pageTitle 
)
See also
SiteLinkStore::getItemIdForLink
Parameters
string$globalSiteId
string$pageTitle
Exceptions
InvalidArgumentExceptionif a parameter does not have the expected type
Returns
ItemId|null

Implements Wikibase\Lib\Store\SiteLinkLookup.

◆ getItemIdForSiteLink()

Wikibase\Lib\Store\HashSiteLinkStore::getItemIdForSiteLink ( SiteLink  $siteLink)
See also
SiteLinkStore::getItemIdForSiteLink
Parameters
SiteLink$siteLink
Returns
ItemId|null

Implements Wikibase\Lib\Store\SiteLinkLookup.

◆ getSiteLinksForItem()

Wikibase\Lib\Store\HashSiteLinkStore::getSiteLinksForItem ( ItemId  $itemId)
See also
SiteLinkStore::getSiteLinksForItem
Parameters
ItemId$itemId
Returns
SiteLink[]

Implements Wikibase\Lib\Store\SiteLinkLookup.

◆ indexByItemId()

Wikibase\Lib\Store\HashSiteLinkStore::indexByItemId ( ItemId  $itemId,
SiteLink  $siteLink 
)
private

◆ indexByLink()

Wikibase\Lib\Store\HashSiteLinkStore::indexByLink ( ItemId  $itemId,
SiteLink  $siteLink 
)
private

◆ linkMatches()

Wikibase\Lib\Store\HashSiteLinkStore::linkMatches ( ItemId  $itemId,
SiteLink  $siteLink,
array  $numericIds,
array  $siteIds,
array  $pageNames 
)
private

Returns true if the link matches the given conditions.

Parameters
ItemId$itemId
SiteLink$siteLink
int[]$numericIdsNumeric (unprefixed) item ids
string[]$siteIds
string[]$pageNames
Returns
bool

◆ makeSiteLinkKey()

Wikibase\Lib\Store\HashSiteLinkStore::makeSiteLinkKey ( SiteLink  $siteLink)
private
Parameters
SiteLink$siteLink
Returns
string

◆ saveLinksOfItem()

Wikibase\Lib\Store\HashSiteLinkStore::saveLinksOfItem ( Item  $item)
See also
SiteLinkStore::saveLinksOfItem
Parameters
Item$item
Returns
bool

Implements Wikibase\Lib\Store\SiteLinkStore.

Member Data Documentation

◆ $itemIdsByLink

Wikibase\Lib\Store\HashSiteLinkStore::$itemIdsByLink = []
private

◆ $linksByItemId

Wikibase\Lib\Store\HashSiteLinkStore::$linksByItemId = []
private

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