DigraphStyle::default()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
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\Styles;
7
8
/**
9
 * It is a container for the partial files used to build the HTML label for the node
10
 */
11
final class DigraphStyle
12
{
13
    private readonly string $theme;
14
15 29
    public static function default(ThemeName $theme): DigraphStyle
16
    {
17 29
        return new DigraphStyle($theme, 'partials/_properties.html.twig', 'partials/_methods.html.twig');
18
    }
19
20 3
    public static function withoutEmptyBlocks(ThemeName $theme): DigraphStyle
21
    {
22 3
        return new DigraphStyle($theme, 'partials/_empty-properties.html.twig', 'partials/_empty-methods.html.twig');
23
    }
24
25 32
    private function __construct(
26
        ThemeName $theme,
27
        private readonly string $properties,
28
        private readonly string $methods
29
    ) {
30 32
        $this->theme = "{$theme->name()}.html.twig";
0 ignored issues
show
Bug introduced by
The property theme is declared read-only in PhUml\Graphviz\Styles\DigraphStyle.
Loading history...
31
    }
32
33 23
    public function properties(): string
34
    {
35 23
        return $this->properties;
36
    }
37
38 23
    public function methods(): string
39
    {
40 23
        return $this->methods;
41
    }
42
43 26
    public function theme(): string
44
    {
45 26
        return $this->theme;
46
    }
47
}
48