1 | <?php |
||
2 | |||
3 | namespace Smoren\GraphTools\Models; |
||
4 | |||
5 | use Smoren\GraphTools\Models\Interfaces\VertexInterface; |
||
6 | |||
7 | /** |
||
8 | * Graph vertex's class |
||
9 | * @author Smoren <[email protected]> |
||
10 | */ |
||
11 | class Vertex implements VertexInterface |
||
12 | { |
||
13 | /** |
||
14 | * @var non-empty-string vertex's id |
||
0 ignored issues
–
show
Documentation
Bug
introduced
by
![]() |
|||
15 | */ |
||
16 | protected string $id; |
||
17 | /** |
||
18 | * @var non-empty-string vertex's type |
||
0 ignored issues
–
show
|
|||
19 | */ |
||
20 | protected string $type; |
||
21 | /** |
||
22 | * @var mixed custom extra data |
||
23 | */ |
||
24 | protected $data; |
||
25 | |||
26 | /** |
||
27 | * Vertex constructor |
||
28 | * @param non-empty-string $id vertex's id |
||
0 ignored issues
–
show
|
|||
29 | * @param non-empty-string $type vertex's type |
||
30 | * @param mixed $data custom extra data |
||
31 | */ |
||
32 | public function __construct(string $id, string $type, $data = null) |
||
33 | { |
||
34 | $this->id = $id; |
||
35 | $this->type = $type; |
||
36 | $this->data = $data; |
||
37 | } |
||
38 | |||
39 | /** |
||
40 | * @inheritDoc |
||
41 | */ |
||
42 | public function getId(): string |
||
43 | { |
||
44 | return $this->id; |
||
45 | } |
||
46 | |||
47 | /** |
||
48 | * @inheritDoc |
||
49 | */ |
||
50 | public function getType(): string |
||
51 | { |
||
52 | return $this->type; |
||
53 | } |
||
54 | |||
55 | /** |
||
56 | * @return mixed |
||
57 | */ |
||
58 | public function getData() |
||
59 | { |
||
60 | return $this->data; |
||
61 | } |
||
62 | } |
||
63 |