Passed
Push — master ( 1416ae...b5a8b1 )
by Luis
54s queued 13s
created

ThemeName   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
dl 0
loc 18
ccs 7
cts 7
cp 1
rs 10
c 1
b 0
f 0
wmc 3
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
final class ThemeName
11
{
12
    /** @var string[] */
13
    private const VALID_NAMES = ['phuml', 'php', 'classic'];
14
15
    private readonly string $name;
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 34
    public function __construct(string $name)
18
    {
19 34
        if (! \in_array($name, self::VALID_NAMES, true)) {
20 1
            throw UnknownTheme::named($name, self::VALID_NAMES);
21
        }
22 33
        $this->name = $name;
23
    }
24
25 32
    public function name(): string
26
    {
27 32
        return $this->name;
28
    }
29
}
30