Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
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 (string $globalSiteId, string $pageTitle)
 
 getSiteLinksForItem (ItemId $itemId)
 Returns an array of SiteLink objects for an item.
 
 getItemIdForSiteLink (SiteLink $siteLink)
 
 saveLinksOfItem (Item $item)
 Saves the links for the provided item.
 
 deleteLinksOfItem (ItemId $itemId)
 Removes the links for the provided item.
 
 getEntityIdForLinkedTitle ( $globalSiteId, $pageTitle)
 
- Public Member Functions inherited from Wikibase\Lib\Store\SiteLinkLookup
 getLinks (?array $numericIds=null, ?array $siteIds=null, ?array $pageNames=null)
 Returns the links that match the provided conditions.
 

Private Member Functions

 linkMatches (ItemId $itemId, SiteLink $siteLink, ?array $numericIds, ?array $siteIds, ?array $pageNames)
 Returns true if the link matches the given conditions.
 
 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

◆ deleteLinksOfItem()

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

Removes the links for the provided item.

Parameters
ItemId$itemId
Returns
bool Success indicator

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 ( string $globalSiteId,
string $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)

◆ getSiteLinksForItem()

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

Returns an array of SiteLink objects for an item.

If the item isn't known or not an Item, an empty array is returned.

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[] | null$numericIdslike for SiteLinkLookup::getLinks()
string[] | null$siteIdslike for SiteLinkLookup::getLinks()
string[] | null$pageNameslike for SiteLinkLookup::getLinks()
Returns
bool

◆ makeSiteLinkKey()

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

◆ saveLinksOfItem()

Wikibase\Lib\Store\HashSiteLinkStore::saveLinksOfItem ( Item $item)

Saves the links for the provided item.

Parameters
Item$item
Returns
bool Success indicator

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: