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

plInterfaceGraphElements   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
class plInterfaceGraphElements
9
{
10
    /** @var plNodeLabelBuilder */
11
    private $labelBuilder;
12
13
    public function __construct(plNodeLabelBuilder $labelBuilder)
14
    {
15
        $this->labelBuilder = $labelBuilder;
16
    }
17
18
    /**
19
     * @return plHasDotRepresentation[]
20
     */
21
    public function extractFrom(plPhpInterface $interface): array
22
    {
23
        $dotElements = [];
24
25
        $dotElements[] = new plNode($interface, $this->labelBuilder->labelForInterface($interface));
26
27
        // Create interface inheritance relation
28
        if ($interface->hasParent()) {
29
            $dotElements[] = plEdge::inheritance($interface->extends, $interface);
30
        }
31
32
        return $dotElements;
33
    }
34
}
35