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

plInterfaceGraphElements::extractFrom()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 12
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 5
nc 2
nop 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