Target::inArray()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace VideoGamesRecords\DwhBundle\ValueObject;
6
7
use Webmozart\Assert\Assert;
8
9
class Target
10
{
11
    public const GAME = 'game';
12
    public const PLAYER = 'PLAYER';
13
    public const TEAM = 'TEAM';
14
15
    public const VALUES = [
16
        self::GAME,
17
        self::PLAYER,
18
        self::TEAM,
19
    ];
20
21
    private string $value;
22
23
    public function __construct(string $value)
24
    {
25
        self::inArray($value);
26
27
        $this->value = $value;
28
    }
29
30
    public static function inArray(string $value): void
31
    {
32
        Assert::inArray($value, self::VALUES);
33
    }
34
35
    public function getValue(): string
36
    {
37
        return $this->value;
38
    }
39
40
    public function __toString(): string
41
    {
42
        return $this->value;
43
    }
44
}
45