Passed
Push — master ( f58add...4aa999 )
by Luis
54s queued 13s
created

DigraphStyle   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 13
c 0
b 0
f 0
dl 0
loc 39
ccs 10
cts 10
cp 1
rs 10
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A methods() 0 3 1
A default() 0 3 1
A theme() 0 3 1
A withoutEmptyBlocks() 0 3 1
A attributes() 0 3 1
A __construct() 0 5 1
1
<?php declare(strict_types=1);
2
/**
3
 * PHP version 7.4
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\Styles;
9
10
/**
11
 * It is a container for the partial files used to build the HTML label for the node
12
 */
13
final class DigraphStyle
14
{
15
    /** @var string */
16
    protected $theme;
17
18
    protected string $attributes;
19
20
    protected string $methods;
21
22
    public static function default(ThemeName $theme): DigraphStyle
23
    {
24 114
        return new DigraphStyle($theme, 'partials/_attributes.html.twig', 'partials/_methods.html.twig');
25
    }
26 114
27 114
    public static function withoutEmptyBlocks(ThemeName $theme): DigraphStyle
28 114
    {
29
        return new DigraphStyle($theme, 'partials/_empty-attributes.html.twig', 'partials/_empty-methods.html.twig');
30 90
    }
31
32 90
    private function __construct(ThemeName $theme, string $attributesTemplate, string $methodsTemplate)
33
    {
34
        $this->theme = "{$theme->name()}.html.twig";
35 90
        $this->attributes = $attributesTemplate;
36
        $this->methods = $methodsTemplate;
37 90
    }
38
39
    public function attributes(): string
40 96
    {
41
        return $this->attributes;
42 96
    }
43
44
    public function methods(): string
45
    {
46
        return $this->methods;
47
    }
48
49
    public function theme(): string
50
    {
51
        return $this->theme;
52
    }
53
}
54