Passed
Push — master ( 19eee0...d416e5 )
by Smoren
02:46
created

Edge   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 76
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 16
dl 0
loc 76
rs 10
c 0
b 0
f 0
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getToId() 0 3 1
A __construct() 0 7 1
A getWeight() 0 3 1
A getFromId() 0 3 1
A getType() 0 3 1
A getId() 0 3 1
1
<?php
2
3
namespace Smoren\GraphTools\Models;
4
5
use Smoren\GraphTools\Models\Interfaces\EdgeInterface;
6
7
class Edge implements EdgeInterface
8
{
9
    /**
10
     * @var non-empty-string
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...
11
     */
12
    protected string $id;
13
    /**
14
     * @var non-empty-string
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 $type;
17
    /**
18
     * @var non-empty-string
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 $fromId;
21
    /**
22
     * @var non-empty-string
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...
23
     */
24
    protected string $toId;
25
    /**
26
     * @var float
27
     */
28
    protected float $weight;
29
30
    /**
31
     * @param non-empty-string $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...
32
     * @param non-empty-string $type
33
     * @param non-empty-string $fromId
34
     * @param non-empty-string $toId
35
     */
36
    public function __construct(string $id, string $type, string $fromId, string $toId, float $weight = 1)
37
    {
38
        $this->id = $id;
39
        $this->type = $type;
40
        $this->fromId = $fromId;
41
        $this->toId = $toId;
42
        $this->weight = $weight;
43
    }
44
45
    /**
46
     * @inheritDoc
47
     */
48
    public function getId(): string
49
    {
50
        return $this->id;
51
    }
52
53
    /**
54
     * @inheritDoc
55
     */
56
    public function getType(): string
57
    {
58
        return $this->type;
59
    }
60
61
    /**
62
     * @inheritDoc
63
     */
64
    public function getFromId(): string
65
    {
66
        return $this->fromId;
67
    }
68
69
    /**
70
     * @inheritDoc
71
     */
72
    public function getToId(): string
73
    {
74
        return $this->toId;
75
    }
76
77
    /**
78
     * @inheritDoc
79
     */
80
    public function getWeight(): float
81
    {
82
        return $this->weight;
83
    }
84
}
85