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

GameComponentEnum::hasTemplateVariables()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 6
ccs 4
cts 4
cp 1
crap 1
rs 10
c 1
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Stu\Module\Game\Component;
6
7
use Override;
0 ignored issues
show
Bug introduced by
The type Override was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use Stu\Component\Game\ModuleViewEnum;
9
use Stu\Lib\Component\ComponentEnumInterface;
10
11
enum GameComponentEnum: string implements ComponentEnumInterface
12
{
13
    case COLONIES = 'COLONIES_NAVLET';
14
    case NAVIGATION = 'NAVIGATION';
15
    case NAGUS = 'NAGUS_POPUP';
16
    case PM = 'PM_NAVLET';
17
    case RESEARCH = 'RESEARCH_NAVLET';
18
    case SERVERTIME_AND_VERSION = 'SERVERTIME';
19
    case USER = 'USER_PROFILE';
20
21 11
    #[Override]
22
    public function getModuleView(): ModuleViewEnum
23
    {
24 11
        return ModuleViewEnum::GAME;
25
    }
26
27 4
    #[Override]
28
    public function getTemplate(): string
29
    {
30 4
        return match ($this) {
31 4
            self::COLONIES => 'html/game/component/coloniesComponent.twig',
32 4
            self::NAVIGATION => 'html/game/component/navigationComponent.twig',
33 4
            self::NAGUS => 'html/game/component/nagusComponent.twig',
34 4
            self::PM => 'html/game/component/pmComponent.twig',
35 3
            self::RESEARCH => 'html/game/component/researchComponent.twig',
36 3
            self::SERVERTIME_AND_VERSION => 'html/game/component/serverTimeAndVersionComponent.twig',
37 4
            self::USER => 'html/game/component/userComponent.twig',
38 4
        };
39
    }
40
41 7
    #[Override]
42
    public function getRefreshIntervalInSeconds(): ?int
43
    {
44 7
        return match ($this) {
45 7
            self::PM => 60,
46 5
            self::SERVERTIME_AND_VERSION => 300,
47 7
            default => null
48 7
        };
49
    }
50
51 4
    #[Override]
52
    public function hasTemplateVariables(): bool
53
    {
54 4
        return match ($this) {
55 4
            self::NAVIGATION => false,
56 4
            default => true
57 4
        };
58
    }
59
60 7
    #[Override]
61
    public function getValue(): string
62
    {
63 7
        return $this->value;
64
    }
65
}
66