SnakRemover   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 26
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A removeSnaksOfSubject() 0 5 2
1
<?php
2
3
namespace Wikibase\QueryEngine\SQLStore\SnakStore;
4
5
use Wikibase\DataModel\Entity\EntityId;
6
7
/**
8
 * Use case for removing snaks from the store.
9
 *
10
 * TODO: this can be made more efficient by providing the list of snaks
11
 * the entity has, so deletes can be run just against the relevant
12
 * data value type specific tables.
13
 *
14
 * @licence GNU GPL v2+
15
 * @author Jeroen De Dauw < [email protected] >
16
 */
17
class SnakRemover {
18
19
	/**
20
	 * @var SnakStore[]
21
	 */
22
	private $snakStores;
23
24
	/**
25
	 * @param SnakStore[] $snakStores
26
	 */
27
	public function __construct( array $snakStores ) {
28
		$this->snakStores = $snakStores;
29
	}
30
31
	/**
32
	 * @param EntityId $subjectId
33
	 *
34
	 * TODO: exception
35
	 */
36
	public function removeSnaksOfSubject( EntityId $subjectId ) {
37
		foreach ( $this->snakStores as $snakStore ) {
38
			$snakStore->removeSnaksOfSubject( $subjectId );
39
		}
40
	}
41
42
}
43