ValuelessSnakRow   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 2
A getInternalSnakType() 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
 * @licence GNU GPL v2+
10
 * @author Jeroen De Dauw < [email protected] >
11
 */
12
class ValuelessSnakRow extends SnakRow {
13
14
	const TYPE_NO_VALUE = 0;
15
	const TYPE_SOME_VALUE = 1;
16
17
	private $internalSnakType;
18
19
	/**
20
	 * @param int $internalSnakType
21
	 * @param string $propertyId
22
	 * @param int $snakRole
23
	 * @param EntityId $subjectId
24
	 * @param int $statementRank
25
	 *
26
	 * @throws InvalidArgumentException
27
	 */
28
	public function __construct( $internalSnakType, $propertyId, $snakRole, EntityId $subjectId, $statementRank ) {
29
		if ( !in_array( $internalSnakType, array( self::TYPE_NO_VALUE, self::TYPE_SOME_VALUE ), true ) ) {
30
			throw new InvalidArgumentException( 'Invalid internal snak type provided' );
31
		}
32
33
		parent::__construct( $propertyId, $snakRole, $subjectId, $statementRank );
34
35
		$this->internalSnakType = $internalSnakType;
36
	}
37
38
	/**
39
	 * @return int
40
	 */
41
	public function getInternalSnakType() {
42
		return $this->internalSnakType;
43
	}
44
45
}
46