Passed
Pull Request — master (#1914)
by Janko
81:21
created

StuConfigSettingEnum   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Test Coverage

Coverage 48%

Importance

Changes 0
Metric Value
eloc 33
dl 0
loc 42
ccs 12
cts 25
cp 0.48
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getParent() 0 13 1
A getConfigPath() 0 13 1
1
<?php
2
3
namespace Stu\Module\Config;
4
5
enum StuConfigSettingEnum: int
6
{
7
    case ADMIN = 1;
8
    case CACHE = 2;
9
    case COLONY = 3;
10
    case DB = 4;
11
    case DEBUG = 5;
12
    case GAME = 6;
13
    case MAP = 7;
14
    case RESET = 8;
15
    case SQL_LOGGING = 9;
16
    case EMAIL = 10;
17
18
    public function getParent(): ?StuConfigSettingEnum
19
    {
20
        return match ($this) {
21
            self::ADMIN => self::GAME,
22
            self::CACHE => null,
23
            self::COLONY => self::GAME,
24
            self::DB => null,
25
            self::DEBUG => null,
26
            self::GAME => null,
27
            self::MAP => self::GAME,
28
            self::RESET => null,
29
            self::SQL_LOGGING => self::DEBUG,
30
            self::EMAIL => self::GAME
31
        };
32
    }
33
34 4
    public function getConfigPath(): string
35
    {
36 4
        return match ($this) {
37 4
            self::ADMIN => 'admin',
38 4
            self::CACHE => 'cache',
39 4
            self::COLONY => 'colony',
40 4
            self::DB => 'db',
41 4
            self::DEBUG => 'debug',
42 4
            self::GAME => 'game',
43 4
            self::MAP => 'map',
44 4
            self::RESET => 'reset',
45 4
            self::SQL_LOGGING => 'sqlLogging',
46 4
            self::EMAIL => 'email'
47 4
        };
48
    }
49
}
50