Completed
Push — master ( f552f8...7247aa )
by
unknown
03:16
created

FingerprintPatcher::applyAliasGroupDiff()   A

Complexity

Conditions 4
Paths 3

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 20

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 9
ccs 0
cts 0
cp 0
rs 9.2
cc 4
eloc 6
nc 3
nop 3
crap 20
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\Term\Fingerprint;
8
9
/**
10
 * TODO: Class should be public.
11
 * TODO: Should this support actual edit conflict detection?
12
 *
13
 * Package private.
14
 *
15
 * @since 1.0
16
 *
17
 * @license GPL-2.0+
18
 * @author Jeroen De Dauw < [email protected] >
19
 * @author Thiemo Mättig
20
 */
21
class FingerprintPatcher {
22
23
	/**
24
	 * @var TermListPatcher
25
	 */
26
	private $termListPatcher;
27 4
28 4
	/**
29 4
	 * @var AliasGroupListPatcher
30
	 */
31
	private $aliasGroupListPatcher;
32
33
	public function __construct() {
34
		$this->termListPatcher = new TermListPatcher();
35
		$this->aliasGroupListPatcher = new AliasGroupListPatcher();
36
	}
37 4
38 4
	/**
39 4
	 * @since 1.0
40 4
	 *
41 4
	 * @param Fingerprint $fingerprint
42
	 * @param EntityDiff $patch
43 4
	 *
44
	 * @throws PatcherException
45 4
	 */
46 4
	public function patchFingerprint( Fingerprint $fingerprint, EntityDiff $patch ) {
47 4
		$this->termListPatcher->patchTermList(
48 4
			$fingerprint->getLabels(),
49
			$patch->getLabelsDiff()
50 4
		);
51
52 4
		$this->termListPatcher->patchTermList(
53 4
			$fingerprint->getDescriptions(),
54
			$patch->getDescriptionsDiff()
55
		);
56
57
		$this->aliasGroupListPatcher->patchAliasGroupList(
58
			$fingerprint->getAliasGroups(),
59
			$patch->getAliasesDiff()
60 4
		);
61 4
	}
62
63
}
64