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

EventMatcher   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 31
rs 10
c 0
b 0
f 0
wmc 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getAggregateId() 0 3 2
A getStreamName() 0 3 2
A getAggregateClass() 0 3 2
A getSequence() 0 3 2
A getTimestamp() 0 3 2
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