Passed
Push — develop ( ceecf5...f3db75 )
by BENARD
16:19 queued 14:24
created

PartnerStatus::getStatusChoices()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
dl 0
loc 5
rs 10
c 1
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ProjetNormandie\PartnerBundle\ValueObject;
6
7
use Webmozart\Assert\Assert;
8
9
class PartnerStatus
10
{
11
    public const ACTIVE = 'ACTIVE';
12
    public const INACTIVE = 'INACTIVE';
13
14
    public const VALUES = [
15
        self::ACTIVE,
16
        self::INACTIVE
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 isActive(): bool
39
    {
40
        return $this->value === self::ACTIVE;
41
    }
42
43
    public function isInactive(): bool
44
    {
45
        return $this->value === self::INACTIVE;
46
    }
47
48
    public function __toString(): string
49
    {
50
        return $this->value;
51
    }
52
53
    /**
54
     * @return string[]
55
     */
56
    public static function getStatusChoices(): array
57
    {
58
        return [
59
            self::ACTIVE => self::ACTIVE,
60
            self::INACTIVE => self::INACTIVE
61
        ];
62
    }
63
}
64