Test Failed
Push — psr4-packages ( 592372 )
by Luis
02:13
created

Edge::association()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 2
1
<?php
2
/**
3
 * PHP version 7.1
4
 *
5
 * This source file is subject to the license that is bundled with this package in the file LICENSE.
6
 */
7
8
namespace PhUml\Graphviz;
9
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)
42
    {
43
        $this->fromNode = $nodeA;
44
        $this->toNode = $nodeB;
45
        $this->options = $options;
46
    }
47
}
48