Symfony2EventDispatcherSubscriber   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A handle() 0 4 1
1
<?php
2
3
namespace Rawkode\Eidetic\EventStore\Symfony2EventDispatcherSubscriber;
4
5
use Rawkode\Eidetic\EventStore\EventSubscriber;
6
use Rawkode\Eidetic\EventSourcing\EventSourcedEntity;
7
use Symfony\Component\EventDispatcher\EventDispatcher;
8
9
final class Symfony2EventDispatcherSubscriber implements EventSubscriber
10
{
11
    /**
12
     * @var EventDispatcher
13
     */
14
    private $eventDispatcher;
15
16
    /**
17
     */
18
    public function __construct(EventDispatcher $eventDispatcher)
19
    {
20
        $this->eventDispatcher = $eventDispatcher;
21
    }
22
23
    /**
24
     * @param int                $eventHook
25
     * @param EventSourcedEntity $eventSourcedEntity
26
     * @param object             $event
27
     */
28
    public function handle($eventHook, EventSourcedEntity $eventSourcedEntity, $event)
29
    {
30
        $this->eventDispatcher->dispatch($eventHook, new EventDispatcherEvent($eventSourcedEntity, $event));
31
    }
32
}
33