Total Complexity | 5 |
Total Lines | 36 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
10 | class Edge implements HasDotRepresentation |
||
11 | { |
||
12 | /** @var HasNodeIdentifier */ |
||
13 | private $fromNode; |
||
14 | |||
15 | /** @var HasNodeIdentifier */ |
||
16 | private $toNode; |
||
17 | |||
18 | /** @var string */ |
||
19 | private $options; |
||
20 | |||
21 | public static function inheritance(HasNodeIdentifier $parent, HasNodeIdentifier $child): Edge |
||
22 | { |
||
23 | return new Edge($parent, $child, 'dir=back arrowtail=empty style=solid'); |
||
24 | } |
||
25 | |||
26 | public static function implementation(HasNodeIdentifier $interface, HasNodeIdentifier $class): Edge |
||
27 | { |
||
28 | return new Edge($interface, $class, 'dir=back arrowtail=normal style=dashed'); |
||
29 | } |
||
30 | |||
31 | public static function association(HasNodeIdentifier $reference, HasNodeIdentifier $class): Edge |
||
32 | { |
||
33 | return new Edge($reference, $class, 'dir=back arrowtail=none style=dashed'); |
||
34 | } |
||
35 | |||
36 | public function toDotLanguage(): string |
||
37 | { |
||
38 | return "\"{$this->fromNode->identifier()}\" -> \"{$this->toNode->identifier()}\" [{$this->options}]\n"; |
||
39 | } |
||
40 | |||
41 | private function __construct(HasNodeIdentifier $nodeA, HasNodeIdentifier $nodeB, string $options) |
||
46 | } |
||
47 | } |
||
48 |