Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\Lib\TermIndexEntry Class Reference

Object representing a term index entry. 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.
 

Public Attributes

const TYPE_LABEL = 'label'
 Term type enum.
 
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

 $termType
 
 $termLanguage
 
 $termText
 
 $entityId
 

Static Private Attributes

static $fieldNames
 

Detailed Description

Object representing a term index entry.

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 ( )
Returns
EntityId

◆ getEntityType()

Wikibase\Lib\TermIndexEntry::getEntityType ( )
Returns
string

◆ getFieldValuesForCompare()

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

◆ getLanguage()

Wikibase\Lib\TermIndexEntry::getLanguage ( )
Returns
string

◆ getTerm()

Wikibase\Lib\TermIndexEntry::getTerm ( )
Returns
Term

◆ getTermType()

Wikibase\Lib\TermIndexEntry::getTermType ( )
Returns
string

◆ getText()

Wikibase\Lib\TermIndexEntry::getText ( )
Returns
string

Member Data Documentation

◆ $entityId

Wikibase\Lib\TermIndexEntry::$entityId
private

◆ $fieldNames

Wikibase\Lib\TermIndexEntry::$fieldNames
staticprivate
Initial value:
= [
]
const FIELD_ENTITY
Definition TermIndexEntry.php:26
const FIELD_LANGUAGE
Definition TermIndexEntry.php:28
const FIELD_TEXT
Definition TermIndexEntry.php:29
const FIELD_TYPE
Definition TermIndexEntry.php:27

◆ $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_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: