FingerprintPatcher   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A patchFingerprint() 0 16 1
1
<?php
2
3
namespace Wikibase\DataModel\Services\Diff\Internal;
4
5
use Diff\Patcher\PatcherException;
6
use Wikibase\DataModel\Services\Diff\EntityDiff;
7
use Wikibase\DataModel\Services\Diff\TermListPatcher;
8
use Wikibase\DataModel\Term\Fingerprint;
9
10
/**
11
 * Package private.
12
 *
13
 * @since 1.0
14
 *
15
 * @license GPL-2.0-or-later
16
 * @author Jeroen De Dauw < [email protected] >
17
 * @author Thiemo Kreuz
18
 */
19
class FingerprintPatcher {
20
21
	/**
22
	 * @var TermListPatcher
23
	 */
24
	private $termListPatcher;
25
26
	/**
27 4
	 * @var AliasGroupListPatcher
28 4
	 */
29 4
	private $aliasGroupListPatcher;
30
31
	public function __construct() {
32
		$this->termListPatcher = new TermListPatcher();
33
		$this->aliasGroupListPatcher = new AliasGroupListPatcher();
34
	}
35
36
	/**
37 4
	 * @since 1.0
38 4
	 *
39 4
	 * @param Fingerprint $fingerprint
40 4
	 * @param EntityDiff $patch
41 4
	 *
42
	 * @throws PatcherException
43 4
	 */
44
	public function patchFingerprint( Fingerprint $fingerprint, EntityDiff $patch ) {
45 4
		$this->termListPatcher->patchTermList(
46 4
			$fingerprint->getLabels(),
47 4
			$patch->getLabelsDiff()
48 4
		);
49
50 4
		$this->termListPatcher->patchTermList(
51
			$fingerprint->getDescriptions(),
52 4
			$patch->getDescriptionsDiff()
53 4
		);
54
55
		$this->aliasGroupListPatcher->patchAliasGroupList(
56
			$fingerprint->getAliasGroups(),
57
			$patch->getAliasesDiff()
58
		);
59
	}
60 4
61
}
62