Completed
Push — master ( 3f1b14...d7a449 )
by Luis
14:49 queued 04:53
created

InterfaceGraphElements   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
dl 0
loc 25
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A extractFrom() 0 12 2
A __construct() 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
namespace PhUml\Graphviz;
9
10
use PhUml\Code\InterfaceDefinition;
11
12
class InterfaceGraphElements
13
{
14
    /** @var NodeLabelBuilder */
15
    private $labelBuilder;
16
17
    public function __construct(NodeLabelBuilder $labelBuilder)
18
    {
19
        $this->labelBuilder = $labelBuilder;
20
    }
21
22
    /**
23
     * @return HasDotRepresentation[]
24
     */
25
    public function extractFrom(InterfaceDefinition $interface): array
26
    {
27
        $dotElements = [];
28
29
        $dotElements[] = new Node($interface, $this->labelBuilder->labelForInterface($interface));
30
31
        // Create interface inheritance relation
32
        if ($interface->hasParent()) {
33
            $dotElements[] = Edge::inheritance($interface->extends, $interface);
34
        }
35
36
        return $dotElements;
37
    }
38
}
39