Wikibase
MediaWiki Wikibase extension
Wikibase\Lib\TermIndexEntry Class Reference

Object representing an entry in the term store (formerly known as the term index). More...

Public Member Functions

 __construct (array $fields)
 
 getTermType ()
 
 getLanguage ()
 
 getText ()
 
 getEntityId ()
 
 getEntityType ()
 
 getTerm ()
 

Static Public Member Functions

static compare (self $a, self $b)
 Imposes an canonical but arbitrary order on Term objects. More...
 

Public Attributes

const TYPE_LABEL = 'label'
 Term type enum. More...
 
const TYPE_ALIAS = 'alias'
 
const TYPE_DESCRIPTION = 'description'
 
const FIELD_ENTITY = 'entityId'
 
const FIELD_TYPE = 'termType'
 
const FIELD_LANGUAGE = 'termLanguage'
 
const FIELD_TEXT = 'termText'
 

Static Public Attributes

static $validTermTypes = [ self::TYPE_ALIAS, self::TYPE_LABEL, self::TYPE_DESCRIPTION ]
 

Private Member Functions

 assertConstructFieldsAreCorrect (array $fields)
 

Static Private Member Functions

static getFieldValuesForCompare (self $entry)
 

Private Attributes

const FIELD_NAMES
 
 $termType
 
 $termLanguage
 
 $termText
 
 $entityId
 

Detailed Description

Object representing an entry in the term store (formerly known as the term index).

Author
Jeroen De Dauw < jeroe.nosp@m.nded.nosp@m.auw@g.nosp@m.mail.nosp@m..com >
Addshore

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Lib\TermIndexEntry::__construct ( array  $fields)
Parameters
array$fieldsAssociative array containing fields: self::FIELD_TYPE => string, one of self::TYPE_* constants, self::FIELD_LANGUAGE => string self::FIELD_TEXT => string self::FIELD_ENTITY => EntityId
Exceptions
ParameterAssertionException

Member Function Documentation

◆ assertConstructFieldsAreCorrect()

Wikibase\Lib\TermIndexEntry::assertConstructFieldsAreCorrect ( array  $fields)
private

◆ compare()

static Wikibase\Lib\TermIndexEntry::compare ( self  $a,
self  $b 
)
static

Imposes an canonical but arbitrary order on Term objects.

Useful for sorting lists of terms for comparison.

Parameters
self$a
self$b
Returns
int Returns 1 if $a is greater than $b, -1 if $b is greater than $a, and 0 otherwise.

◆ getEntityId()

Wikibase\Lib\TermIndexEntry::getEntityId ( )

◆ getEntityType()

Wikibase\Lib\TermIndexEntry::getEntityType ( )

◆ getFieldValuesForCompare()

static Wikibase\Lib\TermIndexEntry::getFieldValuesForCompare ( self  $entry)
staticprivate

◆ getLanguage()

Wikibase\Lib\TermIndexEntry::getLanguage ( )

◆ getTerm()

Wikibase\Lib\TermIndexEntry::getTerm ( )

◆ getTermType()

Wikibase\Lib\TermIndexEntry::getTermType ( )

◆ getText()

Wikibase\Lib\TermIndexEntry::getText ( )

Member Data Documentation

◆ $entityId

Wikibase\Lib\TermIndexEntry::$entityId
private

◆ $termLanguage

Wikibase\Lib\TermIndexEntry::$termLanguage
private

◆ $termText

Wikibase\Lib\TermIndexEntry::$termText
private

◆ $termType

Wikibase\Lib\TermIndexEntry::$termType
private

◆ $validTermTypes

Wikibase\Lib\TermIndexEntry::$validTermTypes = [ self::TYPE_ALIAS, self::TYPE_LABEL, self::TYPE_DESCRIPTION ]
static

◆ FIELD_ENTITY

const Wikibase\Lib\TermIndexEntry::FIELD_ENTITY = 'entityId'

◆ FIELD_LANGUAGE

const Wikibase\Lib\TermIndexEntry::FIELD_LANGUAGE = 'termLanguage'

◆ FIELD_NAMES

const Wikibase\Lib\TermIndexEntry::FIELD_NAMES
private
Initial value:
= [
]
const FIELD_ENTITY
Definition: TermIndexEntry.php:29
const FIELD_LANGUAGE
Definition: TermIndexEntry.php:31
const FIELD_TEXT
Definition: TermIndexEntry.php:32
const FIELD_TYPE
Definition: TermIndexEntry.php:30

◆ FIELD_TEXT

const Wikibase\Lib\TermIndexEntry::FIELD_TEXT = 'termText'

◆ FIELD_TYPE

const Wikibase\Lib\TermIndexEntry::FIELD_TYPE = 'termType'

◆ TYPE_ALIAS

const Wikibase\Lib\TermIndexEntry::TYPE_ALIAS = 'alias'

◆ TYPE_DESCRIPTION

const Wikibase\Lib\TermIndexEntry::TYPE_DESCRIPTION = 'description'

◆ TYPE_LABEL

const Wikibase\Lib\TermIndexEntry::TYPE_LABEL = 'label'

Term type enum.


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