Digraph   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 25
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A id() 0 3 1
A elements() 0 3 1
A add() 0 3 1
A __construct() 0 3 1
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;
7
8
/**
9
 * It is a collection of nodes and edges that can be represented using DOT language
10
 *
11
 * @link https://en.wikipedia.org/wiki/DOT_(graph_description_language) See for more details about DOT language
12
 */
13
final class Digraph
14
{
15
    /** @var HasDotRepresentation[] */
16
    private array $elements;
17
18 27
    public function __construct()
19
    {
20 27
        $this->elements = [];
21
    }
22
23
    /** @param HasDotRepresentation[] $definitions */
24 23
    public function add(array $definitions): void
25
    {
26 23
        $this->elements = array_merge($this->elements, $definitions);
27
    }
28
29
    /** @return HasDotRepresentation[] */
30 26
    public function elements(): array
31
    {
32 26
        return $this->elements;
33
    }
34
35 26
    public function id(): string
36
    {
37 26
        return sha1((string) mt_rand());
38
    }
39
}
40