Vertex::getData()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
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
The doc comment non-empty-string at position 0 could not be parsed: Unknown type name 'non-empty-string' at position 0 in non-empty-string.
Loading history...
15
     */
16
    protected string $id;
17
    /**
18
     * @var non-empty-string vertex's type
0 ignored issues
show
Documentation Bug introduced by
The doc comment non-empty-string at position 0 could not be parsed: Unknown type name 'non-empty-string' at position 0 in non-empty-string.
Loading history...
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
Documentation Bug introduced by
The doc comment non-empty-string at position 0 could not be parsed: Unknown type name 'non-empty-string' at position 0 in non-empty-string.
Loading history...
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