UncommittedEvents   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 16
wmc 3
lcom 1
cbo 3
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A append() 0 8 2
1
<?php
2
3
namespace Domain\Eventing;
4
5
use Domain\Identity\Identity;
6
use Domain\Eventing\Exception\CorruptAggregateHistory;
7
8
/**
9
 * @author Sebastiaan Hilbers <[email protected]>
10
 */
11
class UncommittedEvents extends AbstractEventStream
12
{
13
    public function __construct(Identity $identity)
14
    {
15
        $this->identity = $identity;
16
    }
17
18
    public function append(DomainEvent $event)
19
    {
20
        if ($event->getAggregateIdentity() !== $this->identity) {
21
            throw new CorruptAggregateHistory('Event Identity is not matching the eventstreams\'s identity');
22
        }
23
24
        $this->events[] = $event;
25
    }
26
}
27