SnakRow   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 59
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 7
lcom 0
cbo 0
dl 0
loc 59
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 14 3
A getPropertyId() 0 3 1
A getSnakRole() 0 3 1
A getSubjectId() 0 3 1
A getStatementRank() 0 3 1
1
<?php
2
3
namespace Wikibase\QueryEngine\SQLStore\SnakStore;
4
5
use InvalidArgumentException;
6
use Wikibase\DataModel\Entity\EntityId;
7
8
/**
9
 * Represents a row in a snak table. Immutable.
10
 *
11
 * @licence GNU GPL v2+
12
 * @author Jeroen De Dauw < [email protected] >
13
 */
14
abstract class SnakRow {
15
16
	private $propertyId;
17
	private $snakRole;
18
	private $subjectId;
19
	private $statementRank;
20
21
	/**
22
	 * @param string $propertyId
23
	 * @param int $snakRole
24
	 * @param EntityId $subjectId
25
	 * @param int $statementRank
26
	 *
27
	 * @throws InvalidArgumentException
28
	 */
29
	public function __construct( $propertyId, $snakRole, EntityId $subjectId, $statementRank ) {
30
		if ( !is_string( $propertyId ) ) {
31
			throw new InvalidArgumentException( '$propertyId needs to be a string' );
32
		}
33
34
		if ( !is_int( $snakRole ) ) {
35
			throw new InvalidArgumentException( '$snakRole needs to be an integer' );
36
		}
37
38
		$this->propertyId = $propertyId;
39
		$this->snakRole = $snakRole;
40
		$this->subjectId = $subjectId;
41
		$this->statementRank = $statementRank;
42
	}
43
44
	/**
45
	 * @return string
46
	 */
47
	public function getPropertyId() {
48
		return $this->propertyId;
49
	}
50
51
	/**
52
	 * @return int
53
	 */
54
	public function getSnakRole() {
55
		return $this->snakRole;
56
	}
57
58
	/**
59
	 * @return EntityId
60
	 */
61
	public function getSubjectId() {
62
		return $this->subjectId;
63
	}
64
65
	/**
66
	 * @return int
67
	 */
68
	public function getStatementRank() {
69
		return $this->statementRank;
70
	}
71
72
}
73