Passed
Push — 1.6 ( c2a002 )
by Luis
05:37
created

TraitGraphBuilder   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 16
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A extractFrom() 0 9 2
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\Builders;
9
10
use PhUml\Code\Codebase;
11
use PhUml\Code\TraitDefinition;
12
use PhUml\Graphviz\Edge;
13
use PhUml\Graphviz\Node;
14
15
class TraitGraphBuilder
16
{
17
    /**
18
     * It creates a node for a Trait
19
     *
20
     * @return \PhUml\Graphviz\HasDotRepresentation[]
21
     */
22 42
    public function extractFrom(TraitDefinition $trait, Codebase $codebase): array
23
    {
24 42
        $dotElements = [new Node($trait)];
25
26 42
        foreach ($trait->traits() as $usedTrait) {
27
            $dotElements[] = Edge::use($codebase->get($usedTrait), $trait);
28
        }
29
30 42
        return $dotElements;
31
    }
32
}
33