SimpleStatement   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Coupling/Cohesion

Components 4
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 6
lcom 4
cbo 1
dl 0
loc 49
ccs 0
cts 14
cp 0
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A newInstance() 0 3 1
A withPropertyName() 0 4 1
A withType() 0 4 1
A withValues() 0 4 1
A withPropertyId() 0 4 2
1
<?php
2
3
namespace Queryr\Resources;
4
5
use DataValues\DataValue;
6
use Wikibase\DataModel\Entity\PropertyId;
7
8
/**
9
 * @licence GNU GPL v2+
10
 * @author Jeroen De Dauw < [email protected] >
11
 */
12
class SimpleStatement {
13
14
	/**
15
	 * @var string
16
	 */
17
	public $propertyName;
18
19
	/**
20
	 * @var PropertyId
21
	 */
22
	public $propertyId;
23
24
	/**
25
	 * @var string
26
	 */
27
	public $valueType;
28
29
	/**
30
	 * Should have at least one element.
31
	 *
32
	 * @var DataValue[]
33
	 */
34
	public $values = [];
35
36
	public static function newInstance() {
37
		return new self();
38
	}
39
40
	public function withPropertyName( $propertyName ) {
41
		$this->propertyName = $propertyName;
42
		return $this;
43
	}
44
45
	public function withType( $type ) {
46
		$this->valueType = $type;
47
		return $this;
48
	}
49
50
	public function withValues( array $values ) {
51
		$this->values = $values;
52
		return $this;
53
	}
54
55
	public function withPropertyId( $propertyId ) {
56
		$this->propertyId = is_string( $propertyId ) ? new PropertyId( $propertyId ) : $propertyId;
57
		return $this;
58
	}
59
60
}