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

ProofStatus::isInProgress()   A

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
eloc 1
c 1
b 0
f 0
dl 0
loc 3
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 ProofStatus
8
{
9
    const STATUS_IN_PROGRESS = 'IN PROGRESS';
10
    const STATUS_REFUSED = 'REFUSED';
11
    const STATUS_ACCEPTED = 'ACCEPTED';
12
    const STATUS_CLOSED = 'CLOSED';
13
    const STATUS_DELETED = 'DELETED';
14
15
    public const VALUES = [
16
        self::STATUS_IN_PROGRESS,
17
        self::STATUS_REFUSED,
18
        self::STATUS_ACCEPTED,
19
        self::STATUS_CLOSED,
20
        self::STATUS_DELETED,
21
    ];
22
23
    private string $value;
24
25
    public function __construct(string $value)
26
    {
27
        self::inArray($value);
28
29
        $this->value = $value;
30
    }
31
32
    public static function inArray(string $value): void
33
    {
34
        Assert::inArray($value, self::VALUES);
35
    }
36
37
    public function getValue(): string
38
    {
39
        return $this->value;
40
    }
41
42
    public function __toString(): string
43
    {
44
        return $this->value;
45
    }
46
47
    public function isInProgress(): bool
48
    {
49
        return self::STATUS_IN_PROGRESS === $this->value;
50
    }
51
52
53
    /**
54
     * @return array
55
     */
56
    public static function getStatusChoices(): array
57
    {
58
        return [
59
            self::STATUS_IN_PROGRESS => self::STATUS_IN_PROGRESS,
60
            self::STATUS_REFUSED => self::STATUS_REFUSED,
61
            self::STATUS_ACCEPTED => self::STATUS_ACCEPTED,
62
            self::STATUS_CLOSED => self::STATUS_CLOSED
63
        ];
64
    }
65
}