Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\Client\RepoLinker Class Reference

Public Member Functions

 __construct (EntitySourceDefinitions $entitySourceDefinitions, string $baseUrl, string $articlePath, string $scriptPath)
 
 getPageUrl (string $page)
 
 formatLink (string $url, string $text, array $attribs=[])
 Format a link, with url encoding.
 
 buildEntityLink (EntityId $entityId, array $classes=[], string $text=null)
 Constructs an html link to an entity.
 
 getEntityTitle (EntityId $entityId)
 
 getEntityUrl (EntityId $entityId)
 Constructs a link to an entity.
 
 getEntityConceptUri (EntityId $entityId)
 Constructs the machine followable link to an entity.
 
 getBaseUrl ()
 
 getApiUrl ()
 
 getIndexUrl ()
 
 addQueryParams (string $url, array $params)
 

Private Member Functions

 encodePage (string $page)
 
 getConceptBaseUri (EntityId $entityId)
 

Private Attributes

 $baseUrl
 
 $articlePath
 
 $scriptPath
 
 $entitySourceDefinitions
 

Detailed Description

Author
Katie Filbert < aude..nosp@m.wiki.nosp@m.@gmai.nosp@m.l.co.nosp@m.m >

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Client\RepoLinker::__construct ( EntitySourceDefinitions $entitySourceDefinitions,
string $baseUrl,
string $articlePath,
string $scriptPath )

Member Function Documentation

◆ addQueryParams()

Wikibase\Client\RepoLinker::addQueryParams ( string $url,
array $params )

◆ buildEntityLink()

Wikibase\Client\RepoLinker::buildEntityLink ( EntityId $entityId,
array $classes = [],
string $text = null )

Constructs an html link to an entity.

Parameters
EntityId$entityId
array$classes
string | null$textDefaults to the entity id serialization.
Returns
string (html)

◆ encodePage()

Wikibase\Client\RepoLinker::encodePage ( string $page)
private

◆ formatLink()

Wikibase\Client\RepoLinker::formatLink ( string $url,
string $text,
array $attribs = [] )

Format a link, with url encoding.

Parameters
string$url
string$text
array$attribs
Returns
string (html)

◆ getApiUrl()

Wikibase\Client\RepoLinker::getApiUrl ( )

◆ getBaseUrl()

Wikibase\Client\RepoLinker::getBaseUrl ( )

◆ getConceptBaseUri()

Wikibase\Client\RepoLinker::getConceptBaseUri ( EntityId $entityId)
private
Parameters
EntityId$entityId
Exceptions
LogicExceptionwhen there is no base URI for the repository $entityId belongs to
Returns
string

◆ getEntityConceptUri()

Wikibase\Client\RepoLinker::getEntityConceptUri ( EntityId $entityId)

Constructs the machine followable link to an entity.

E.g., https://www.wikidata.org/entity/Q42.

Parameters
EntityId$entityId
Exceptions
LogicExceptionwhen there is no base URI for the repository $entityId belongs to
Returns
string

◆ getEntityTitle()

Wikibase\Client\RepoLinker::getEntityTitle ( EntityId $entityId)

◆ getEntityUrl()

Wikibase\Client\RepoLinker::getEntityUrl ( EntityId $entityId)

Constructs a link to an entity.

Parameters
EntityId$entityId
Returns
string

◆ getIndexUrl()

Wikibase\Client\RepoLinker::getIndexUrl ( )

◆ getPageUrl()

Wikibase\Client\RepoLinker::getPageUrl ( string $page)
Parameters
string$page
Exceptions
InvalidArgumentException
Returns
string

Member Data Documentation

◆ $articlePath

Wikibase\Client\RepoLinker::$articlePath
private

◆ $baseUrl

Wikibase\Client\RepoLinker::$baseUrl
private

◆ $entitySourceDefinitions

Wikibase\Client\RepoLinker::$entitySourceDefinitions
private

◆ $scriptPath

Wikibase\Client\RepoLinker::$scriptPath
private

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