Completed
Push — master ( 6e0bb5...dae7dc )
by GBProd
04:09
created

Dispatcher   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 1
cbo 2
dl 0
loc 26
ccs 10
cts 10
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A dispatch() 0 7 1
1
<?php
2
3
namespace GBProd\DomainEventBundle\Event;
4
5
use GBProd\DomainEvent\Dispatcher as DomainEventDispatcher;
6
use GBProd\DomainEvent\DomainEvent;
7
use Symfony\Component\EventDispatcher\EventDispatcher;
8
9
/**
10
 * Domain dispatcher implementation for symfony dispatcher
11
 * 
12
 * @author gbprod <[email protected]>
13
 */
14
class Dispatcher implements DomainEventDispatcher
15
{
16
    /**
17
     * @var EventDispatcher
18
     */
19
    private $dispatcher;
20
    
21
    /**
22
     * @param EventDispatcher $dispatcher
23
     */
24 2
    public function __construct(EventDispatcher $dispatcher)
25 1
    {
26 2
        $this->dispatcher = $dispatcher;
27 2
    }
28
    
29
    /**
30
     * {@inheritdoc}
31
     */
32 1
    public function dispatch(DomainEvent $event)
33
    {
34 1
        $this->dispatcher->dispatch(
35 1
            get_class($event),
36 1
            new Event($event)
37 1
        );
38
    }
39
}