Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\Repo\Api\EntityByTitleHelper Class Reference

Helper class for api modules to resolve page+title pairs into entities. More...

Public Member Functions

 __construct (ApiBase $apiModule, ResultBuilder $resultBuilder, EntityByLinkedTitleLookup $entityByLinkedTitleLookup, SiteLookup $siteLookup, StringNormalizer $stringNormalizer)
 
 getEntityIds (array $sites, array $titles, $normalize)
 Tries to find item ids for given client pages.
 
 normalizeTitle (&$title, Site $site)
 Tries to normalize the given page title against the given client site.
 

Private Member Functions

 getEntityId ( $siteId, $title, $normalize)
 Tries to find item id for given siteId and title combination.
 
 throwUsageException ( $message, $code)
 

Private Attributes

 $apiModule
 
 $resultBuilder
 
 $entityByLinkedTitleLookup
 
 $siteLookup
 
 $stringNormalizer
 

Detailed Description

Helper class for api modules to resolve page+title pairs into entities.

Author
Marius Hoch < hoo@o.nosp@m.nlin.nosp@m.e.de >
Addshore
Daniel Kinzler

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Repo\Api\EntityByTitleHelper::__construct ( ApiBase  $apiModule,
ResultBuilder  $resultBuilder,
EntityByLinkedTitleLookup  $entityByLinkedTitleLookup,
SiteLookup  $siteLookup,
StringNormalizer  $stringNormalizer 
)

Member Function Documentation

◆ getEntityId()

Wikibase\Repo\Api\EntityByTitleHelper::getEntityId (   $siteId,
  $title,
  $normalize 
)
private

Tries to find item id for given siteId and title combination.

Parameters
string$siteId
string$title
bool$normalize
Returns
EntityId|null

◆ getEntityIds()

Wikibase\Repo\Api\EntityByTitleHelper::getEntityIds ( array  $sites,
array  $titles,
  $normalize 
)

Tries to find item ids for given client pages.

Parameters
array$sites
array$titles
bool$normalize
Exceptions
ApiUsageException
Returns
array[] ( EntityId[], array[] ) List containing valid $ids and $missingEntities site title combinations -return array{0:EntityId[],1:array[]}

◆ normalizeTitle()

Wikibase\Repo\Api\EntityByTitleHelper::normalizeTitle ( $title,
Site  $site 
)

Tries to normalize the given page title against the given client site.

Updates $title accordingly and adds the normalization to the API output.

Parameters
string&$title
Site$site

◆ throwUsageException()

Wikibase\Repo\Api\EntityByTitleHelper::throwUsageException (   $message,
  $code 
)
private
Parameters
string$message
string$code
Exceptions
ApiUsageExceptionalways

Member Data Documentation

◆ $apiModule

Wikibase\Repo\Api\EntityByTitleHelper::$apiModule
private

◆ $entityByLinkedTitleLookup

Wikibase\Repo\Api\EntityByTitleHelper::$entityByLinkedTitleLookup
private

◆ $resultBuilder

Wikibase\Repo\Api\EntityByTitleHelper::$resultBuilder
private

◆ $siteLookup

Wikibase\Repo\Api\EntityByTitleHelper::$siteLookup
private

◆ $stringNormalizer

Wikibase\Repo\Api\EntityByTitleHelper::$stringNormalizer
private

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