Passed
Push — master ( 927e42...56a221 )
by Blixit
02:05
created

EventMatcher::getTimestamp()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 1
nc 2
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Blixit\EventSourcing\Store\Matcher;
6
7
class EventMatcher extends Matcher implements EventMatcherInterface
8
{
9
    /** @var string[] $allowedFields */
10
    protected $allowedFields = ['streamName', 'aggregateId', 'aggregateClass', 'timestamp', 'sequence'];
11
12
    public function getStreamName() : ?string
13
    {
14
        return isset($this->fields['streamName']) ? $this->fields['streamName']->getValue() : null;
15
    }
16
17
    /**
18
     * @return mixed
19
     */
20
    public function getAggregateId()
21
    {
22
        return isset($this->fields['aggregateId']) ? $this->fields['aggregateId']->getValue() : null;
23
    }
24
25
    public function getAggregateClass() : ?string
26
    {
27
        return isset($this->fields['aggregateClass']) ? $this->fields['aggregateClass']->getValue() : null;
28
    }
29
30
    public function getTimestamp() : ?int
31
    {
32
        return isset($this->fields['timestamp']) ? $this->fields['timestamp']->getValue() : null;
33
    }
34
35
    public function getSequence() : ?int
36
    {
37
        return isset($this->fields['sequence']) ? $this->fields['sequence']->getValue() : null;
38
    }
39
}
40