TermStoreEntityHandler::getHandlingMessage()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 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
}