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

DigraphStyle::withoutEmptyBlocks()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
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