TermStoreEntityHandler   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
c 0
b 0
f 0
lcom 1
cbo 1
dl 0
loc 22
ccs 11
cts 11
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A handleEntity() 0 8 2
A getHandlingMessage() 0 3 1
1
<?php
2
3
namespace Queryr\Replicator\Importer\EntityHandlers;
4
5
use Queryr\Replicator\Importer\EntityHandler;
6
use Queryr\TermStore\TermStoreWriter;
7
use Wikibase\DataModel\Entity\EntityDocument;
8
use Wikibase\DataModel\Term\FingerprintProvider;
9
10
/**
11
 * @licence GNU GPL v2+
12
 * @author Jeroen De Dauw < [email protected] >
13
 */
14
class TermStoreEntityHandler implements EntityHandler {
15
16
	private $tsWriter;
17
18 1
	public function __construct( TermStoreWriter $tsWriter ) {
19 1
		$this->tsWriter = $tsWriter;
20 1
	}
21
22 1
	public function handleEntity( EntityDocument $entity ) {
23 1
		if ( $entity instanceof FingerprintProvider ) {
24 1
			$this->tsWriter->storeEntityFingerprint(
25 1
				$entity->getId(),
26 1
				$entity->getFingerprint()
27
			);
28
		}
29 1
	}
30
31 1
	public function getHandlingMessage( EntityDocument $entity ): string {
32 1
		return 'Inserting into Term store';
33
	}
34
35
}