ReferencedEntityIdLookup
last analyzed

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 22
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
getReferencedEntityId() 0 1 ?
1
<?php
2
3
namespace Wikibase\DataModel\Services\Lookup;
4
5
use Wikibase\DataModel\Entity\EntityId;
6
use Wikibase\DataModel\Entity\PropertyId;
7
8
/**
9
 * Service interface for getting a referenced entity (out of a specified set),
10
 * from a given starting entity. The starting entity, and the target entities
11
 * are (potentially indirectly, via intermediate entities) linked by statements
12
 * with a given property ID, pointing from the starting entity to one of the
13
 * target entities.
14
 *
15
 * @since 3.10
16
 *
17
 * @license GPL-2.0-or-later
18
 * @author Marius Hoch
19
 */
20
interface ReferencedEntityIdLookup {
21
22
	/**
23
	 * Get the referenced entity (out of $toIds), from a given entity. The starting entity, and
24
	 * the target entities are (potentially indirectly, via intermediate entities) linked by
25
	 * statements with the given property ID, pointing from the starting entity to one of the
26
	 * target entities.
27
	 * Implementations of this may or may not return the closest referenced entity (where
28
	 * distance is defined by the number of intermediate entities).
29
	 *
30
	 * @since 3.10
31
	 *
32
	 * @param EntityId $fromId
33
	 * @param PropertyId $propertyId
34
	 * @param EntityId[] $toIds
35
	 *
36
	 * @return EntityId|null Returns null in case none of the target entities are referenced.
37
	 * @throws ReferencedEntityIdLookupException
38
	 */
39
	public function getReferencedEntityId( EntityId $fromId, PropertyId $propertyId, array $toIds );
40
41
}
42