Passed
Push — master ( 1ba30a...8ac47c )
by Luis
01:05 queued 12s
created

EnumGraphBuilder   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
dl 0
loc 16
ccs 7
cts 7
cp 1
rs 10
c 1
b 0
f 0
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A extractFrom() 0 13 3
1
<?php declare(strict_types=1);
2
/**
3
 * This source file is subject to the license that is bundled with this package in the file LICENSE.
4
 */
5
6
namespace PhUml\Graphviz\Builders;
7
8
use PhUml\Code\Codebase;
9
use PhUml\Code\EnumDefinition;
10
use PhUml\Graphviz\Edge;
11
use PhUml\Graphviz\HasDotRepresentation;
12
use PhUml\Graphviz\Node;
13
14
final class EnumGraphBuilder
15
{
16
    /** @return HasDotRepresentation[] */
17 13
    public function extractFrom(EnumDefinition $enum, Codebase $codebase): array
18
    {
19 13
        $dotElements = [new Node($enum)];
20
21 13
        foreach ($enum->interfaces() as $interface) {
22 12
            $dotElements[] = Edge::implementation($codebase->get($interface), $enum);
23
        }
24
25 13
        foreach ($enum->traits() as $usedTrait) {
26 12
            $dotElements[] = Edge::use($codebase->get($usedTrait), $enum);
27
        }
28
29 13
        return $dotElements;
30
    }
31
}
32