Wikibase
MediaWiki Wikibase extension
|
EntityLookup that uses an in memory array to retrieve the requested information. More...
Public Member Functions | |
__construct (... $entities) | |
addEntity (EntityDocument $entity) | |
addException (EntityLookupException $exception) | |
Registers an exception that will be thrown when a entity with the id in the exception is requested. More... | |
getEntity (EntityId $entityId) | |
hasEntity (EntityId $entityId) | |
getItemForId (ItemId $itemId) | |
getPropertyForId (PropertyId $propertyId) | |
Private Member Functions | |
throwExceptionIfNeeded (EntityId $entityId) | |
Private Attributes | |
$entities = [] | |
$exceptions = [] | |
EntityLookup that uses an in memory array to retrieve the requested information.
One can also specify exceptions that should be thrown when an entity with their associated ID is requested.
This class can be used as a fake in tests.
Wikibase\DataModel\Services\Lookup\InMemoryEntityLookup::__construct | ( | $entities | ) |
EntityDocument | ...$entities |
Wikibase\DataModel\Services\Lookup\InMemoryEntityLookup::addEntity | ( | EntityDocument | $entity | ) |
EntityDocument | $entity |
InvalidArgumentException |
Wikibase\DataModel\Services\Lookup\InMemoryEntityLookup::addException | ( | EntityLookupException | $exception | ) |
Registers an exception that will be thrown when a entity with the id in the exception is requested.
If an exception with the same EntityId was already present it will be replaced by the new one.
EntityLookupException | $exception |
Wikibase\DataModel\Services\Lookup\InMemoryEntityLookup::getEntity | ( | EntityId | $entityId | ) |
EntityId | $entityId |
EntityLookupException |
Implements Wikibase\DataModel\Services\Lookup\EntityLookup.
Wikibase\DataModel\Services\Lookup\InMemoryEntityLookup::getItemForId | ( | ItemId | $itemId | ) |
ItemId | $itemId |
ItemLookupException |
Implements Wikibase\DataModel\Services\Lookup\ItemLookup.
Wikibase\DataModel\Services\Lookup\InMemoryEntityLookup::getPropertyForId | ( | PropertyId | $propertyId | ) |
PropertyId | $propertyId |
PropertyLookupException |
Implements Wikibase\DataModel\Services\Lookup\PropertyLookup.
Wikibase\DataModel\Services\Lookup\InMemoryEntityLookup::hasEntity | ( | EntityId | $entityId | ) |
EntityId | $entityId |
EntityLookupException |
Implements Wikibase\DataModel\Services\Lookup\EntityLookup.
|
private |
|
private |
|
private |