DispatchingEntityIdForTermLookup   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 4
c 2
b 0
f 0
lcom 1
cbo 1
dl 0
loc 35
ccs 10
cts 10
cp 1
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getEntityIdsForTerm() 0 3 1
A getItemIdsForTerm() 0 3 1
A getPropertyIdsForTerm() 0 3 1
1
<?php
2
3
namespace Wikibase\EntityStore\Internal;
4
5
use Wikibase\DataModel\Entity\Item;
6
use Wikibase\DataModel\Entity\Property;
7
use Wikibase\DataModel\Term\Term;
8
use Wikibase\EntityStore\ItemIdForTermLookup;
9
use Wikibase\EntityStore\PropertyIdForTermLookup;
10
11
/**
12
 * Internal class
13
 *
14
 * @licence GPLv2+
15
 * @author Thomas Pellissier Tanon
16
 */
17
class DispatchingEntityIdForTermLookup implements ItemIdForTermLookup, PropertyIdForTermLookup, EntityIdForTermLookup {
18
19
	/**
20
	 * @var EntityIdForTermLookup
21
	 */
22
	private $entityIdForTermLookup;
23
24
	/**
25
	 * @param EntityIdForTermLookup $entityIdForTermLookup
26
	 */
27 5
	public function __construct( EntityIdForTermLookup $entityIdForTermLookup ) {
28 5
		$this->entityIdForTermLookup = $entityIdForTermLookup;
29 5
	}
30
31
	/**
32
	 * @see EntityDocumentForTermLookup:getEntityDocumentsForTerm
33
	 */
34 1
	public function getEntityIdsForTerm( Term $term, $entityType = null ) {
35 1
		return $this->entityIdForTermLookup->getEntityIdsForTerm( $term, $entityType );
36
	}
37
38
	/**
39
	 * @see ItemForTermLookup::getItemForTerm
40
	 */
41 3
	public function getItemIdsForTerm( Term $term ) {
42 3
		return $this->entityIdForTermLookup->getEntityIdsForTerm( $term, Item::ENTITY_TYPE );
43
	}
44
45
	/**
46
	 * @see PropertyForTermLookup::getPropertyForTerm
47
	 */
48 3
	public function getPropertyIdsForTerm( Term $term ) {
49 3
		return $this->entityIdForTermLookup->getEntityIdsForTerm( $term, Property::ENTITY_TYPE );
50 1
	}
51
}
52