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

SubEvent::equals()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 12
rs 9.8666
c 0
b 0
f 0
cc 3
nc 3
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace CultuurNet\UDB3\Event\ValueObjects;
6
7
use CultuurNet\UDB3\Timestamp;
8
9
final class SubEvent
10
{
11
    /**
12
     * @var Timestamp
13
     */
14
    private $timestamp;
15
16
    /**
17
     * @var Status
18
     */
19
    private $status;
20
21
    public function __construct(Timestamp $timestamp, Status $status)
22
    {
23
        $this->timestamp = $timestamp;
24
        $this->status = $status;
25
    }
26
27
    public function getTimestamp(): Timestamp
28
    {
29
        return $this->timestamp;
30
    }
31
32
    public function getStatus(): Status
33
    {
34
        return $this->status;
35
    }
36
37
    public function equals(SubEvent $otherSubEvent): bool
38
    {
39
        if (!$this->timestamp->equals($otherSubEvent->getTimestamp())) {
40
            return false;
41
        }
42
43
        if (!$this->status->equals($otherSubEvent->getStatus())) {
44
            return false;
45
        }
46
47
        return true;
48
    }
49
}
50