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

plEdge   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 5
dl 0
loc 36
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A association() 0 3 1
A __construct() 0 5 1
A implementation() 0 3 1
A inheritance() 0 3 1
A toDotLanguage() 0 3 1
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