Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\DataModel\Services\Lookup\RestrictedEntityLookup Class Reference

EntityLookup that counts how many entities have been loaded through it and throws an exception once to many entities have been loaded. More...

+ Inheritance diagram for Wikibase\DataModel\Services\Lookup\RestrictedEntityLookup:
+ Collaboration diagram for Wikibase\DataModel\Services\Lookup\RestrictedEntityLookup:

Public Member Functions

 __construct (EntityLookup $entityLookup, $entityAccessLimit)
 
 getEntity (EntityId $entityId)
 
 hasEntity (EntityId $entityId)
 
 getEntityAccessCount ()
 Returns the number of entities already loaded via this object.
 
 reset ()
 Resets the number and list of entities loaded via this object.
 
 entityHasBeenAccessed (EntityId $entityId)
 Whether an entity has been accessed before via this RestrictedEntityLookup.
 

Private Attributes

 $entityLookup
 
 $entityAccessLimit
 
 $entitiesAccessed = []
 
 $entityAccessCount = 0
 

Detailed Description

EntityLookup that counts how many entities have been loaded through it and throws an exception once to many entities have been loaded.

This is needed to limit the number of entities that can be loaded via some user controlled features, like entity access in Lua.

Since
2.0
Author
Marius Hoch < hoo@o.nosp@m.nlin.nosp@m.e.de >

Constructor & Destructor Documentation

◆ __construct()

Wikibase\DataModel\Services\Lookup\RestrictedEntityLookup::__construct ( EntityLookup $entityLookup,
$entityAccessLimit )
Parameters
EntityLookup$entityLookup
int$entityAccessLimit
Exceptions
InvalidArgumentException

Member Function Documentation

◆ entityHasBeenAccessed()

Wikibase\DataModel\Services\Lookup\RestrictedEntityLookup::entityHasBeenAccessed ( EntityId $entityId)

Whether an entity has been accessed before via this RestrictedEntityLookup.

Since
2.0
Parameters
EntityId$entityId
Returns
bool

◆ getEntity()

Wikibase\DataModel\Services\Lookup\RestrictedEntityLookup::getEntity ( EntityId $entityId)
See also
EntityLookup::getEntity
Parameters
EntityId$entityId
Exceptions
EntityAccessLimitException
Returns
EntityDocument

Implements Wikibase\DataModel\Services\Lookup\EntityLookup.

◆ getEntityAccessCount()

Wikibase\DataModel\Services\Lookup\RestrictedEntityLookup::getEntityAccessCount ( )

Returns the number of entities already loaded via this object.

Since
2.0
Returns
int

◆ hasEntity()

Wikibase\DataModel\Services\Lookup\RestrictedEntityLookup::hasEntity ( EntityId $entityId)
See also
EntityLookup::hasEntity
Parameters
EntityId$entityId
Returns
bool
Exceptions
EntityLookupException

Implements Wikibase\DataModel\Services\Lookup\EntityLookup.

◆ reset()

Wikibase\DataModel\Services\Lookup\RestrictedEntityLookup::reset ( )

Resets the number and list of entities loaded via this object.

Since
3.4

Member Data Documentation

◆ $entitiesAccessed

Wikibase\DataModel\Services\Lookup\RestrictedEntityLookup::$entitiesAccessed = []
private

◆ $entityAccessCount

Wikibase\DataModel\Services\Lookup\RestrictedEntityLookup::$entityAccessCount = 0
private

◆ $entityAccessLimit

Wikibase\DataModel\Services\Lookup\RestrictedEntityLookup::$entityAccessLimit
private

◆ $entityLookup

Wikibase\DataModel\Services\Lookup\RestrictedEntityLookup::$entityLookup
private

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