Completed
Push — master ( e3710c...4d7c64 )
by Jeroen De
12:33
created

GraphNode::setLabel()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 3
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
namespace SRF\Graph;
4
5
class GraphNode {
6
	private $id;
7
	private $parent = [];
8
	private $label;
9
10
	/**
11
	 * @var string $id : Node ID including namespace
12
	 */
13 3
	public function __construct( $id ) {
14 3
		$this->id = $id;
15 3
	}
16
17 1
	public function getID() {
18 1
		return $this->id;
19
	}
20
21
	/**
22
	 * @var string $predicate : the "predicate" linking an object to a subject
23
	 * @var srting $object : the object, linked to this node
24
	 */
25 1
	public function addParentNode( $predicate, $object ) {
26 1
		$this->parent[] = [
27 1
			"predicate" => $predicate,
28 1
			"object"    => $object
29
		];
30 1
	}
31
32
	/**
33
	 * @return array Of parent nodes
34
	 */
35 1
	public function getParentNode() {
36 1
		return $this->parent;
37
	}
38
39
	/**
40
	 * @param string $label : a label, e.g. Display Title, used instead of $id.
41
	 */
42 1
	public function setLabel($label){
43 1
		$this->label = $label;
44 1
	}
45
46 1
	public function getLabel() {
47 1
		return $this->label;
48
	}
49
50
}
51