Link::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 6
rs 10
cc 1
nc 1
nop 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Koriym\AppStateDiagram;
6
7
final class Link
8
{
9
    /** @var string */
10
    public $from;
11
12
    /** @var string */
13
    public $to;
14
15
    /** @var string */
16
    public $label;
17
18
    /** @var TransDescriptor */
19
    public $transDescriptor;
20
21
    public function __construct(SemanticDescriptor $semantic, TransDescriptor $trans, LabelNameInterface $labelName)
22
    {
23
        $this->from = $semantic->id;
24
        $this->to = $trans->rt;
25
        $this->label = $labelName->getLinkLabel($trans);
26
        $this->transDescriptor = $trans;
27
    }
28
29
    public function __toString(): string
30
    {
31
        return $this->label;
32
    }
33
}
34