Passed
Pull Request — master (#22)
by Luis
24:40 queued 21:48
created

DigraphStyle   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 32
ccs 13
cts 13
cp 1
rs 10
c 0
b 0
f 0
wmc 6
1
<?php declare(strict_types=1);
2
/**
3
 * PHP version 8.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\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
    private readonly string $theme;
0 ignored issues
show
Bug introduced by
A parse error occurred: Syntax error, unexpected T_STRING, expecting T_VARIABLE on line 15 at column 21
Loading history...
16
17 29
    public static function default(ThemeName $theme): DigraphStyle
18
    {
19 29
        return new DigraphStyle($theme, 'partials/_properties.html.twig', 'partials/_methods.html.twig');
20
    }
21
22 3
    public static function withoutEmptyBlocks(ThemeName $theme): DigraphStyle
23
    {
24 3
        return new DigraphStyle($theme, 'partials/_empty-properties.html.twig', 'partials/_empty-methods.html.twig');
25
    }
26
27 32
    private function __construct(
28
        ThemeName $theme,
29
        private readonly string $properties,
30
        private readonly string $methods
31
    ) {
32 32
        $this->theme = "{$theme->name()}.html.twig";
33
    }
34
35 23
    public function properties(): string
36
    {
37 23
        return $this->properties;
38
    }
39
40 23
    public function methods(): string
41
    {
42 23
        return $this->methods;
43
    }
44
45 26
    public function theme(): string
46
    {
47 26
        return $this->theme;
48
    }
49
}
50