Passed
Push — master ( 6b02b9...a180a6 )
by Nico
26:39 queued 18:43
created

GameEnum   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Test Coverage

Coverage 28.57%

Importance

Changes 0
Metric Value
eloc 24
dl 0
loc 40
ccs 2
cts 7
cp 0.2857
rs 10
c 0
b 0
f 0
wmc 6

1 Method

Rating   Name   Duplication   Size   Complexity  
A gameStateTypeToDescription() 0 15 6
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Stu\Component\Game;
6
7
final class GameEnum
8
{
9
    //game states
10
    public const CONFIG_GAMESTATE = 1;
11
    public const CONFIG_GAMESTATE_VALUE_ONLINE = 1;
12
    public const CONFIG_GAMESTATE_VALUE_TICK = 2;
13
    public const CONFIG_GAMESTATE_VALUE_MAINTENANCE = 3;
14
    public const CONFIG_GAMESTATE_VALUE_RELOCATION = 4;
15
    public const CONFIG_GAMESTATE_VALUE_RESET = 5;
16
17
    //user stuff
18
    public const USER_ONLINE_PERIOD = 300;
19
20
    //trade stuff
21
    public const MAX_TRADELICENSE_COUNT = 9999;
22
23
    //fleet stuff
24
    public const CREW_PER_FLEET = 100;
25
26
    //commnet stuff
27
    public const KN_PER_SITE = 6;
28
29
    /**
30
     * Returns the textual representation for a game state
31
     */
32 2
    public static function gameStateTypeToDescription(int $stateId): string
33
    {
34
        switch ($stateId) {
35
            case GameEnum::CONFIG_GAMESTATE_VALUE_ONLINE:
36
                return 'Online';
37
            case GameEnum::CONFIG_GAMESTATE_VALUE_MAINTENANCE:
38
                return 'Wartung';
39
            case GameEnum::CONFIG_GAMESTATE_VALUE_RESET:
40 2
                return 'Reset';
41
            case GameEnum::CONFIG_GAMESTATE_VALUE_RELOCATION:
42
                return 'Umzug';
43
            case GameEnum::CONFIG_GAMESTATE_VALUE_TICK:
44
                return 'Tick';
45
            default:
46
                return '';
47
        }
48
    }
49
}
50