Passed
Push — master ( a55f22...56813c )
by Paweł
02:35
created

EventType   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 18
c 1
b 0
f 0
dl 0
loc 58
ccs 0
cts 20
cp 0
rs 10
wmc 10

10 Methods

Rating   Name   Duplication   Size   Complexity  
A fight() 0 3 1
A __toString() 0 3 1
A dialog() 0 3 1
A encounter() 0 3 1
A loot() 0 3 1
A retreat() 0 3 1
A travel() 0 3 1
A explore() 0 3 1
A trade() 0 3 1
A __construct() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace AardsGerds\Game\Event;
6
7
final class EventType implements \Stringable
8
{
9
    public const FIGHT = 'fight';
10
    public const DIALOG = 'dialog';
11
    public const TRADE = 'trade';
12
    public const TRAVEL = 'travel';
13
    public const ENCOUNTER = 'encounter';
14
    public const LOOT = 'loot';
15
    public const EXPLORE = 'explore';
16
    public const RETREAT = 'retreat';
17
18
    private function __construct(
19
        private string $value,
20
    ) {}
21
22
    public static function fight(): self
23
    {
24
        return new self(self::FIGHT);
25
    }
26
27
    public static function dialog(): self
28
    {
29
        return new self(self::DIALOG);
30
    }
31
32
    public static function trade(): self
33
    {
34
        return new self(self::TRADE);
35
    }
36
37
    public static function travel(): self
38
    {
39
        return new self(self::TRAVEL);
40
    }
41
42
    public static function encounter(): self
43
    {
44
        return new self(self::ENCOUNTER);
45
    }
46
47
    public static function loot(): self
48
    {
49
        return new self(self::LOOT);
50
    }
51
52
    public static function explore(): self
53
    {
54
        return new self(self::EXPLORE);
55
    }
56
57
    public static function retreat(): self
58
    {
59
        return new self(self::RETREAT);
60
    }
61
62
    public function __toString(): string
63
    {
64
        return $this->value;
65
    }
66
}
67