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

EventType::travel()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
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