Passed
Push — master ( 5a11dc...578008 )
by Janko
08:39
created

GameStateEnum::getDescription()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 6
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 8
ccs 7
cts 7
cp 1
crap 1
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Stu\Component\Game;
6
7
enum GameStateEnum: int
8
{
9
    case ONLINE = 1;
10
    case TICK = 2;
11
    case MAINTENANCE = 3;
12
    case RELOCATION = 4;
13
    case RESET = 5;
14
15
    /**
16
     * Returns the textual representation for a game state
17
     */
18 212
    public function getDescription(): string
19
    {
20 212
        return match ($this) {
21 212
            self::ONLINE => 'Online',
22 2
            self::TICK => 'Tick',
23 2
            self::MAINTENANCE => 'Wartung',
24 2
            self::RESET => 'Reset',
25 212
            self::RELOCATION => 'Umzug'
26 212
        };
27
    }
28
}
29