Wikibase
MediaWiki Wikibase extension
Wikibase\Repo\Content\DeferredDecodingEntityHolder Class Reference

EntityHolder implementing deferred deserialization. More...

+ Inheritance diagram for Wikibase\Repo\Content\DeferredDecodingEntityHolder:
+ Collaboration diagram for Wikibase\Repo\Content\DeferredDecodingEntityHolder:

Public Member Functions

 __construct (EntityContentDataCodec $codec, $blob, $contentFormat, $entityType, EntityId $entityId=null)
 
 getEntity ( $expectedClass=EntityDocument::class)
 
 getEntityId ()
 
 getEntityType ()
 

Private Attributes

 $entity = null
 
 $codec
 
 $blob
 
 $contentFormat
 
 $entityType
 
 $entityId = null
 

Detailed Description

EntityHolder implementing deferred deserialization.

Author
Daniel Kinzler
Thiemo Kreuz

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Repo\Content\DeferredDecodingEntityHolder::__construct ( EntityContentDataCodec  $codec,
  $blob,
  $contentFormat,
  $entityType,
EntityId  $entityId = null 
)
Parameters
EntityContentDataCodec$codec
string$blob
string | null$contentFormatSerialization format to decode the blob, typically CONTENT_FORMAT_JSON.
string$entityType
EntityId | null$entityId
Exceptions
InvalidArgumentException

Member Function Documentation

◆ getEntity()

Wikibase\Repo\Content\DeferredDecodingEntityHolder::getEntity (   $expectedClass = EntityDocument::class)
See also
EntityHolder::getEntityId

This implements lazy deserialization of the blob passed to the constructor.

Parameters
string$expectedClassThe class with which the result is expected to be compatible. Defaults to EntityDocument.
Exceptions
RuntimeExceptionIf the entity held by this EntityHolder is not compatible with $expectedClass.
Returns
EntityDocument

Implements Wikibase\Repo\Content\EntityHolder.

◆ getEntityId()

Wikibase\Repo\Content\DeferredDecodingEntityHolder::getEntityId ( )
See also
EntityHolder::getEntityId
Exceptions
RuntimeExceptionIf the entity held by this EntityHolder does not have an id.
Returns
EntityId

Implements Wikibase\Repo\Content\EntityHolder.

◆ getEntityType()

Wikibase\Repo\Content\DeferredDecodingEntityHolder::getEntityType ( )

Member Data Documentation

◆ $blob

Wikibase\Repo\Content\DeferredDecodingEntityHolder::$blob
private

◆ $codec

Wikibase\Repo\Content\DeferredDecodingEntityHolder::$codec
private

◆ $contentFormat

Wikibase\Repo\Content\DeferredDecodingEntityHolder::$contentFormat
private

◆ $entity

Wikibase\Repo\Content\DeferredDecodingEntityHolder::$entity = null
private

◆ $entityId

Wikibase\Repo\Content\DeferredDecodingEntityHolder::$entityId = null
private

◆ $entityType

Wikibase\Repo\Content\DeferredDecodingEntityHolder::$entityType
private

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