Passed
Push — master ( f50aa1...d726cb )
by Nico
57:47 queued 28:23
created

StuConfigSettingEnum::getConfigPath()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 1.006

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 10
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 12
ccs 9
cts 11
cp 0.8182
crap 1.006
rs 9.9332
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
17
    public function getParent(): ?StuConfigSettingEnum
18
    {
19
        return match ($this) {
20
            self::ADMIN => self::GAME,
21
            self::CACHE => null,
22
            self::COLONY => self::GAME,
23
            self::DB => null,
24
            self::DEBUG => null,
25
            self::GAME => null,
26
            self::MAP => self::GAME,
27
            self::RESET => null,
28
            self::SQL_LOGGING => self::DEBUG
29
        };
30
    }
31
32 4
    public function getConfigPath(): string
33
    {
34 4
        return match ($this) {
35 4
            self::ADMIN => 'admin',
36 4
            self::CACHE => 'cache',
37 4
            self::COLONY => 'colony',
38 4
            self::DB => 'db',
39 4
            self::DEBUG => 'debug',
40 4
            self::GAME => 'game',
41
            self::MAP => 'map',
42
            self::RESET => 'reset',
43 4
            self::SQL_LOGGING => 'sqlLogging'
44 4
        };
45
    }
46
}
47