Completed
Push — master ( ba82d8...306a50 )
by Daniel
03:11
created

Projector   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 24
c 0
b 0
f 0
wmc 2
lcom 1
cbo 1
ccs 5
cts 5
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A emit() 0 4 1
A emittedEventsByStream() 0 4 1
1
<?php
2
3
namespace DDDominio\EventSourcing\EventStore\Projection;
4
5
use DDDominio\EventSourcing\Common\DomainEvent;
6
7
class Projector
8
{
9
    /**
10
     * @var array
11
     */
12
    private $emittedEventsByStream = [];
13
14
    /**
15
     * @param string $stream
16
     * @param mixed $event
17
     */
18 5
    public function emit($stream, $event)
19
    {
20 5
        $this->emittedEventsByStream[$stream][] = DomainEvent::record($event);
21 5
    }
22
23
    /**
24
     * @return array
25
     */
26 10
    public function emittedEventsByStream()
27
    {
28 10
        return $this->emittedEventsByStream;
29
    }
30
}
31