EntityLookup
last analyzed

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
getEntity() 0 1 ?
hasEntity() 0 1 ?
1
<?php
2
3
namespace Wikibase\DataModel\Services\Lookup;
4
5
use Wikibase\DataModel\Entity\EntityDocument;
6
use Wikibase\DataModel\Entity\EntityId;
7
8
/**
9
 * Service interface for retrieving Entities from storage.
10
 *
11
 * @since 1.1
12
 *
13
 * @license GPL-2.0-or-later
14
 * @author Jeroen De Dauw < [email protected] >
15
 * @author Daniel Kinzler
16
 */
17
interface EntityLookup {
18
19
	/**
20
	 * @note Implementations of this method may or may not resolve redirects.
21
	 * Code that needs control over redirect resolution should use an
22
	 * EntityRevisionLookup instead.
23
	 *
24
	 * @since 2.0
25
	 *
26
	 * @param EntityId $entityId
27
	 *
28
	 * @return EntityDocument|null
29
	 * @throws EntityLookupException
30
	 */
31
	public function getEntity( EntityId $entityId );
32
33
	/**
34
	 * Returns whether the given entity can bee looked up using
35
	 * getEntity(). This avoids loading and deserializing entity content
36
	 * just to check whether the entity exists.
37
	 *
38
	 * @note Implementations of this method may or may not resolve redirects.
39
	 * Code that needs control over redirect resolution should use an
40
	 * EntityRevisionLookup instead.
41
	 *
42
	 * @since 1.1
43
	 *
44
	 * @param EntityId $entityId
45
	 *
46
	 * @return bool
47
	 * @throws EntityLookupException
48
	 */
49
	public function hasEntity( EntityId $entityId );
50
51
}
52