Completed
Push — master ( 389baa...c7c5a4 )
by Luis
14:17 queued 08:06
created

Digraph::toDotLanguage()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 7
ccs 3
cts 3
cp 1
crap 1
rs 9.4285
c 0
b 0
f 0

1 Method

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