Passed
Push — master ( 25d289...e72e86 )
by Nico
46:03 queued 22:37
created

PirateReactionTriggerEnum   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 4
Bugs 0 Features 1
Metric Value
eloc 24
c 4
b 0
f 1
dl 0
loc 33
ccs 0
cts 19
cp 0
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getWrath() 0 10 1
A triggerAlternativeReaction() 0 10 1
1
<?php
2
3
namespace Stu\Lib\Pirate;
4
5
enum PirateReactionTriggerEnum: int
6
{
7
    case ON_ATTACK = 1;
8
    case ON_SCAN = 2;
9
    case ON_INTERCEPTION = 3;
10
    case ON_SUPPORT_CALL = 4;
11
    case ON_RAGE = 5;
12
    case ON_TRACTOR = 6;
13
    case ON_BEAM = 7;
14
15
    public function getWrath(): int
16
    {
17
        return match ($this) {
18
            self::ON_ATTACK => 30,
19
            self::ON_TRACTOR => 25,
20
            self::ON_INTERCEPTION => 20,
21
            self::ON_BEAM => 15,
22
            self::ON_SCAN => 10,
23
            self::ON_SUPPORT_CALL => 0,
24
            self::ON_RAGE => 0,
25
        };
26
    }
27
28
    public function triggerAlternativeReaction(): bool
29
    {
30
        return match ($this) {
31
            self::ON_TRACTOR => false,
32
            self::ON_ATTACK => true,
33
            self::ON_INTERCEPTION => true,
34
            self::ON_BEAM => true,
35
            self::ON_SCAN => true,
36
            self::ON_SUPPORT_CALL => true,
37
            self::ON_RAGE => true
38
        };
39
    }
40
}
41