Completed
Pull Request — master (#16)
by Thomas
06:38
created

InMemoryEntityStore   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 5
c 2
b 0
f 1
lcom 0
cbo 3
dl 0
loc 44
ccs 12
cts 12
cp 1
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getEntityLookup() 0 3 1
A getEntityDocumentLookup() 0 3 1
A getItemLookup() 0 3 1
A getPropertyLookup() 0 3 1
1
<?php
2
3
namespace Wikibase\EntityStore\InMemory;
4
5
use Wikibase\DataModel\Entity\EntityDocument;
6
use Wikibase\EntityStore\EntityStore;
7
use Wikibase\EntityStore\Internal\DispatchingEntityLookup;
8
9
/**
10
 * @licence GPLv2+
11
 * @author Thomas Pellissier Tanon
12
 */
13
class InMemoryEntityStore extends EntityStore {
14
15
	/**
16
	 * @var DispatchingEntityLookup
17
	 */
18
	private $entityLookup;
19
20
	/**
21
	 * @param EntityDocument[] $entities
22
	 */
23 4
	public function __construct( array $entities ) {
24 4
		parent::__construct();
25
26 4
		$this->entityLookup = new DispatchingEntityLookup( new InMemoryEntityLookup( $entities ) );
27 4
	}
28
29
	/**
30
	 * @see EntityStore::getEntityLookup
31
	 */
32 1
	public function getEntityLookup() {
33 1
		return $this->entityLookup;
34
	}
35
36
	/**
37
	 * @see EntityStore::getEntityDocumentLookup
38
	 */
39 1
	public function getEntityDocumentLookup() {
40 1
		return $this->entityLookup;
41
	}
42
43
	/**
44
	 * @see EntityStore::getItemLookup
45
	 */
46 1
	public function getItemLookup() {
47 1
		return $this->entityLookup;
48
	}
49
50
	/**
51
	 * @see EntityStore::getPropertyLookup
52
	 */
53 1
	public function getPropertyLookup() {
54 1
		return $this->entityLookup;
55
	}
56
}
57