Passed
Push — dev ( 5a9cf3...b0d117 )
by Nico
07:29
created

UserEnum::getUserStateDescription()   B

Complexity

Conditions 10
Paths 10

Size

Total Lines 23
Code Lines 20

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 110

Importance

Changes 0
Metric Value
cc 10
eloc 20
c 0
b 0
f 0
nc 10
nop 1
dl 0
loc 23
ccs 0
cts 11
cp 0
crap 110
rs 7.6666

How to fix   Complexity   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
namespace Stu\Module\PlayerSetting\Lib;
4
5
use Stu\Component\Game\TimeConstants;
6
7
final class UserEnum
8
{
9
    //NPC IDs
10
    public const USER_NOONE = 1;
11
    public const USER_NPC_FERG = 14;
12
13
    // first user id (below are NPCs)
14
    public const USER_FIRST_ID = 100;
15
16
    // user state
17
    public const USER_STATE_NEW = 0;
18
    public const USER_STATE_UNCOLONIZED = 1;
19
    public const USER_STATE_ACTIVE = 2;
20
    public const USER_STATE_SMS_VERIFICATION = 3;
21
    public const USER_STATE_COLONIZATION_SHIP = 4;
22
    public const USER_STATE_TUTORIAL1 = 5;
23
    public const USER_STATE_TUTORIAL2 = 6;
24
    public const USER_STATE_TUTORIAL3 = 7;
25
    public const USER_STATE_TUTORIAL4 = 8;
26
27
28
    //DELMARK
29
    public const DELETION_REQUESTED = 1;
30
    public const DELETION_CONFIRMED = 2;
31
    public const DELETION_FORBIDDEN = 3;
32
    public const DELETION_EXECUTED = 4;
33
34
    //VACATION DELAY
35
    public const VACATION_DELAY_IN_SECONDS = TimeConstants::TWO_DAYS_IN_SECONDS;
36
37
    public static function getUserStateDescription(int $userState): string
38
    {
39
        switch ($userState) {
40
            case self::USER_STATE_NEW:
41
                return _("NEU");
42
            case self::USER_STATE_UNCOLONIZED:
43
                return _("OHNE KOLONIEN");
44
            case self::USER_STATE_ACTIVE:
45
                return _("AKTIV");
46
            case self::USER_STATE_SMS_VERIFICATION:
47
                return _("SMS VERIFIKATION");
48
            case self::USER_STATE_COLONIZATION_SHIP:
49
                return _("KOLONISATIONS SCHIFF");
50
            case self::USER_STATE_TUTORIAL1:
51
                return _("TUTORIAL GEBÄUDE");
52
            case self::USER_STATE_TUTORIAL2:
53
                return _("TUTORIAL FORSCHUNG");
54
            case self::USER_STATE_TUTORIAL3:
55
                return _("TUTORIAL SCHIFFE");
56
            case self::USER_STATE_TUTORIAL4:
57
                return _("TUTORIAL HANDEL");
58
        }
59
        return '';
60
    }
61
}
62