1 | <?php |
||
17 | class Node extends Entity { |
||
18 | /** |
||
19 | * @var int |
||
20 | */ |
||
21 | private $id; |
||
22 | |||
23 | /** |
||
24 | * @var Relation[] |
||
25 | */ |
||
26 | private $relations = []; |
||
27 | |||
28 | /** |
||
29 | * @param int $id |
||
30 | * @param string $type |
||
31 | * @param array<string,mixed> $properties |
||
32 | */ |
||
33 | 79 | public function __construct($id, $type, array $properties) { |
|
38 | |||
39 | /** |
||
40 | * Get the id. |
||
41 | * |
||
42 | * @return int |
||
43 | */ |
||
44 | 3 | public function id() { |
|
47 | |||
48 | /** |
||
49 | * Add a relation from this graph to another. |
||
50 | * |
||
51 | * @param string $type |
||
52 | * @param array<string,mixed> $properties |
||
53 | * @param Node $other |
||
54 | * @return Relation |
||
55 | */ |
||
56 | 59 | public function add_relation($type, array $properties, Node $other) { |
|
61 | |||
62 | 59 | protected function build_relation($type, array $properties, $other) { |
|
65 | |||
66 | /** |
||
67 | * Get the relations to other nodes. |
||
68 | * |
||
69 | * @param \Closure|null $filter |
||
70 | * @return Relation[] |
||
71 | */ |
||
72 | 36 | public function relations(\Closure $filter = null) { |
|
80 | |||
81 | /** |
||
82 | * Get all related nodes, where relations might be filtered. |
||
83 | * |
||
84 | * @param \Closure|null $filter |
||
85 | * @return Node[] |
||
86 | */ |
||
87 | 11 | public function related_nodes(\Closure $filter = null) { |
|
92 | } |
||
93 |