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

DigraphPrinter::toDot()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 5
ccs 4
cts 4
cp 1
crap 1
rs 9.4285
c 0
b 0
f 0
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
use PhUml\Graphviz\Styles\DefaultDigraphStyle;
11
use PhUml\Graphviz\Styles\DigraphStyle;
12
use PhUml\Templates\TemplateEngine;
13
14
class DigraphPrinter
15
{
16
    /** @var TemplateEngine */
17
    private $engine;
18
19
    /** @var DigraphStyle */
20
    private $style;
21
22 108
    public function __construct(TemplateEngine $engine = null, DigraphStyle $style = null)
23
    {
24 108
        $this->engine = $engine ?? new TemplateEngine();
25 108
        $this->style = $style ?? new DefaultDigraphStyle();
26 108
    }
27
28 93
    public function toDot(Digraph $digraph): string
29
    {
30 93
        return trim($this->engine->render('digraph.html.twig', [
31 93
            'digraph' => $digraph,
32 93
            'style' => $this->style,
33
        ]));
34
    }
35
}
36