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

plInterfaceGraphElements::__construct()   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 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