Completed
Push — master ( be7a44...a89c67 )
by Filipe
01:07 queued 10s
created

AbstractEvent::eventId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
/**
4
 * This file is part of slick/event package
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
namespace Slick\Event\Domain;
11
12
use DateTimeImmutable;
13
use Slick\Event\Event;
14
15
/**
16
 * AbstractEvent
17
 *
18
 * @package Slick\Event\Domain
19
 */
20
abstract class AbstractEvent implements Event
21
{
22
23
    /**
24
     * @var EventId
25
     */
26
    protected $eventId;
27
28
    /**
29
     * @var DateTimeImmutable
30
     */
31
    protected $occurredOn;
32
33
    /**
34
     * Creates an Abstract Event
35
     */
36
    public function __construct()
37
    {
38
        $this->eventId = new EventId();
39
        $this->occurredOn = new DateTimeImmutable();
40
    }
41
42
    /**
43
     * Event identifier
44
     *
45
     * @return EventId
46
     */
47
    public function eventId(): EventId
48
    {
49
        return $this->eventId;
50
    }
51
52
    /**
53
     * The date and time that event has occurred
54
     *
55
     * @return DateTimeImmutable
56
     */
57
    public function occurredOn(): DateTimeImmutable
58
    {
59
        return $this->occurredOn;
60
    }
61
}
62