Passed
Push — master ( e1d27c...888025 )
by Paweł
03:21
created

VisitorRole::merchant()   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
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace AardsGerds\Game\Location;
6
7
final class VisitorRole implements \Stringable
8
{
9
    private const ROLE_MERCHANT = 'merchant';
10
    private const ROLE_TEACHER = 'teacher';
11
    private const ROLE_QUEST_GIVER = 'quest giver';
12
13 1
    private function __construct(
14
        private string $role,
15 1
    ) {}
16
17
    public static function merchant(): self
18
    {
19
        return new self(self::ROLE_MERCHANT);
20
    }
21
22
    public static function teacher(): self
23
    {
24
        return new self(self::ROLE_TEACHER);
25
    }
26
27 1
    public static function questGiver(): self
28
    {
29 1
        return new self(self::ROLE_QUEST_GIVER);
30
    }
31
32
    public function __toString(): string
33
    {
34
        return $this->role;
35
    }
36
}
37