| Total Complexity | 6 |
| Total Lines | 78 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 11 | class Edge implements EdgeInterface |
||
| 12 | { |
||
| 13 | /** |
||
| 14 | * @var non-empty-string edge's id |
||
|
|
|||
| 15 | */ |
||
| 16 | protected string $id; |
||
| 17 | /** |
||
| 18 | * @var non-empty-string edge's type |
||
| 19 | */ |
||
| 20 | protected string $type; |
||
| 21 | /** |
||
| 22 | * @var non-empty-string start vertex's id of edge |
||
| 23 | */ |
||
| 24 | protected string $fromId; |
||
| 25 | /** |
||
| 26 | * @var non-empty-string end vertex's id of edge |
||
| 27 | */ |
||
| 28 | protected string $toId; |
||
| 29 | /** |
||
| 30 | * @var float edge's weight |
||
| 31 | */ |
||
| 32 | protected float $weight; |
||
| 33 | |||
| 34 | /** |
||
| 35 | * Edge constructor |
||
| 36 | * @param non-empty-string $id edge's id |
||
| 37 | * @param non-empty-string $type edge's type |
||
| 38 | * @param non-empty-string $fromId start vertex's id of edge |
||
| 39 | * @param non-empty-string $toId end vertex's id of edge |
||
| 40 | * @param float $weight edge's weight |
||
| 41 | */ |
||
| 42 | public function __construct(string $id, string $type, string $fromId, string $toId, float $weight = 1) |
||
| 43 | { |
||
| 44 | $this->id = $id; |
||
| 45 | $this->type = $type; |
||
| 46 | $this->fromId = $fromId; |
||
| 47 | $this->toId = $toId; |
||
| 48 | $this->weight = $weight; |
||
| 49 | } |
||
| 50 | |||
| 51 | /** |
||
| 52 | * @inheritDoc |
||
| 53 | */ |
||
| 54 | public function getId(): string |
||
| 55 | { |
||
| 56 | return $this->id; |
||
| 57 | } |
||
| 58 | |||
| 59 | /** |
||
| 60 | * @inheritDoc |
||
| 61 | */ |
||
| 62 | public function getType(): string |
||
| 63 | { |
||
| 64 | return $this->type; |
||
| 65 | } |
||
| 66 | |||
| 67 | /** |
||
| 68 | * @inheritDoc |
||
| 69 | */ |
||
| 70 | public function getFromId(): string |
||
| 71 | { |
||
| 72 | return $this->fromId; |
||
| 73 | } |
||
| 74 | |||
| 75 | /** |
||
| 76 | * @inheritDoc |
||
| 77 | */ |
||
| 78 | public function getToId(): string |
||
| 81 | } |
||
| 82 | |||
| 83 | /** |
||
| 84 | * @inheritDoc |
||
| 85 | */ |
||
| 86 | public function getWeight(): float |
||
| 89 | } |
||
| 90 | } |
||
| 91 |