Passed
Push — dev ( b6688d...d42601 )
by Janko
11:12
created

ModuleViewEnum::getPhpPage()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Stu\Component\Game;
6
7
use RuntimeException;
8
use Stu\Lib\Component\ComponentEnumInterface;
9
use Stu\Module\Game\Component\GameComponentEnum;
10
11
enum ModuleViewEnum: string
12
{
13
    case INDEX = 'index';
14
    case GAME = 'game';
15
    case MAINDESK = 'maindesk';
16
    case COLONY = 'colony';
17
    case SHIP = 'ship';
18
    case STATION = 'station';
19
    case COMMUNICATION = 'comm';
20
    case PM = 'pm';
21
    case NOTES = 'notes';
22
    case RESEARCH = 'research';
23
    case TRADE = 'trade';
24
    case ALLIANCE = 'alliance';
25
    case DATABASE = 'database';
26
    case HISTORY = 'history';
27
    case MAP = 'starmap';
28
    case OPTIONS = 'options';
29
    case PROFILE = 'userprofile';
30
    case ADMIN = 'admin';
31
    case NPC = 'npc';
32
33 23
    public function getPhpPage(): string
34
    {
35 23
        return sprintf('%s.php', $this->value);
36
    }
37
38 4
    public function getTitle(): string
39
    {
40 4
        return match ($this) {
41 4
            self::INDEX => 'Star Trek Universe - Login',
42 4
            self::GAME => 'Star Trek Universe',
43 4
            self::MAINDESK => 'Maindesk',
44 3
            self::COLONY => 'Kolonien',
45 3
            self::SHIP => 'Schiffe',
46 3
            self::STATION => 'Stationen',
47 3
            self::COMMUNICATION => 'KommNet',
48 3
            self::PM => 'Nachrichten',
49 3
            self::RESEARCH => 'Forschung',
50 3
            self::TRADE => 'Handel',
51 3
            self::ALLIANCE => 'Allianz',
52 3
            self::DATABASE => 'Datenbank',
53 3
            self::HISTORY => 'Ereignisse',
54 3
            self::MAP => 'Karte',
55
            self::NOTES => 'Notizen',
56
            self::OPTIONS => 'Optionen',
57
            self::PROFILE => 'Spielerprofil',
58
            self::ADMIN => 'Adminbereich',
59 4
            self::NPC => 'NPC'
60 4
        };
61
    }
62
63 7
    public function getTemplate(): string
64
    {
65 7
        return match ($this) {
66 7
            self::INDEX => 'html/index/index.twig',
67 7
            self::GAME => 'html/game/game.twig',
68 4
            self::MAINDESK => 'html/view/maindesk.twig',
69 4
            self::COLONY => 'html/view/colonylist.twig',
70 4
            self::SHIP => 'html/view/shiplist.twig',
71 4
            self::STATION => 'html/view/stationList.twig',
72 4
            self::COMMUNICATION => 'html/view/communication.twig',
73
            self::PM => 'html/view/pmCategory.twig',
74
            self::RESEARCH => 'html/view/research.twig',
75
            self::TRADE => 'html/view/trade.twig',
76
            self::ALLIANCE => 'html/view/alliance.twig',
77
            self::DATABASE => 'html/view/database.twig',
78
            self::HISTORY => 'html/view/history.twig',
79
            self::MAP => 'html/view/map.twig',
80
            self::NOTES => 'not needed',
81
            self::OPTIONS => 'html/view/options.twig',
82
            self::PROFILE => 'html/view/userprofile.twig',
83
            self::ADMIN => 'not needed',
84 7
            self::NPC => 'not needed'
85 7
        };
86
    }
87
88
    public function getComponentEnum(string $value): ComponentEnumInterface
89
    {
90
        return match ($this) {
91
            self::GAME => GameComponentEnum::from($value),
92
                //self::COLONY => GuiComponentEnum::from($value),
93
            default => throw new RuntimeException('no components in this module view')
94
        };
95
    }
96
}
97