Test Failed
Push — graphviz-refactoring ( 3f1b14 )
by Luis
02:18
created

plEdge::implementation()   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
class plEdge implements plHasDotRepresentation
9
{
10
    /** @var plHasNodeIdentifier */
11
    private $fromNode;
12
13
    /** @var plHasNodeIdentifier */
14
    private $toNode;
15
16
    /** @var string */
17
    private $options;
18
19
    public static function inheritance(plHasNodeIdentifier $parent, plHasNodeIdentifier $child): plEdge
20
    {
21
        return new plEdge($parent, $child, 'dir=back arrowtail=empty style=solid');
22
    }
23
24
    public static function implementation(plHasNodeIdentifier $interface, plHasNodeIdentifier $class): plEdge
25
    {
26
        return new plEdge($interface, $class, 'dir=back arrowtail=normal style=dashed');
27
    }
28
29
    public static function association(plHasNodeIdentifier $reference, plHasNodeIdentifier $class): plEdge
30
    {
31
        return new plEdge($reference, $class, 'dir=back arrowtail=none style=dashed');
32
    }
33
34
    public function toDotLanguage(): string
35
    {
36
        return "\"{$this->fromNode->identifier()}\" -> \"{$this->toNode->identifier()}\" [{$this->options}]\n";
37
    }
38
39
    private function __construct(plHasNodeIdentifier $nodeA, plHasNodeIdentifier $nodeB, string $options)
40
    {
41
        $this->fromNode = $nodeA;
42
        $this->toNode = $nodeB;
43
        $this->options = $options;
44
    }
45
}
46