Passed
Push — develop ( ee6f8b...860277 )
by BENARD
04:16
created

ProofRequestStatus::getStatusChoices()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 6
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
namespace VideoGamesRecords\CoreBundle\ValueObject;
4
5
use Webmozart\Assert\Assert;
6
7
class ProofRequestStatus
8
{
9
    const STATUS_IN_PROGRESS = 'IN PROGRESS';
10
    const STATUS_REFUSED = 'REFUSED';
11
    const STATUS_ACCEPTED = 'ACCEPTED';
12
13
    public const VALUES = [
14
        self::STATUS_IN_PROGRESS,
15
        self::STATUS_REFUSED,
16
        self::STATUS_ACCEPTED
17
    ];
18
19
    private string $value;
20
21
    public function __construct(string $value)
22
    {
23
        self::inArray($value);
24
25
        $this->value = $value;
26
    }
27
28
    public static function inArray(string $value): void
29
    {
30
        Assert::inArray($value, self::VALUES);
31
    }
32
33
    public function getValue(): string
34
    {
35
        return $this->value;
36
    }
37
38
    public function __toString(): string
39
    {
40
        return $this->value;
41
    }
42
43
    public function isInProgress(): bool
44
    {
45
        return self::STATUS_IN_PROGRESS === $this->value;
46
    }
47
48
49
    /**
50
     * @return array
51
     */
52
    public static function getStatusChoices(): array
53
    {
54
        return [
55
            self::STATUS_IN_PROGRESS => self::STATUS_IN_PROGRESS,
56
            self::STATUS_REFUSED => self::STATUS_REFUSED,
57
            self::STATUS_ACCEPTED => self::STATUS_ACCEPTED
58
        ];
59
    }
60
}