Completed
Pull Request — master (#478)
by Luc
02:16
created

Status::equals()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace CultuurNet\UDB3\Event\ValueObjects;
6
7
class Status
8
{
9
    private const SCHEDULED = 'scheduled';
10
    private const POSTPONED = 'postponed';
11
    private const CANCELLED = 'cancelled';
12
13
    /**
14
     * @var string
15
     */
16
    private $value;
17
18
    public function __construct(string $value)
19
    {
20
        $this->value = $value;
21
    }
22
23
    public static function scheduled(): Status
24
    {
25
        return new Status(self::SCHEDULED);
26
    }
27
28
    public static function postponed(): Status
29
    {
30
        return new Status(self::POSTPONED);
31
    }
32
33
    public static function cancelled(): Status
34
    {
35
        return new Status(self::CANCELLED);
36
    }
37
38
    public function toNative(): string
39
    {
40
        return $this->value;
41
    }
42
43
    public function equals(Status $status): bool
44
    {
45
        return $this->value === $status->toNative();
46
    }
47
}
48