Completed
Branch 0.4-dev (999b58)
by Evgenij
18:41
created

EventHandlerFromSymfonyEventDispatcher   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A invokeEvent() 0 4 1
1
<?php
2
/**
3
 * Async sockets
4
 *
5
 * @copyright Copyright (c) 2015-2016, Efimov Evgenij <[email protected]>
6
 *
7
 * This source file is subject to the MIT license that is bundled
8
 * with this source code in the file LICENSE.
9
 */
10
namespace AsyncSockets\RequestExecutor;
11
12
use AsyncSockets\Event\Event;
13
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
14
15
/**
16
 * Class EventHandlerFromSymfonyEventDispatcher
17
 */
18
class EventHandlerFromSymfonyEventDispatcher implements EventHandlerInterface
19
{
20
    /**
21
     * EventDispatcherInterface
22
     *
23
     * @var EventDispatcherInterface
24
     */
25
    private $eventDispatcher;
26
27
    /**
28
     * EventHandlerFromSymfonyEventDispatcher constructor.
29
     *
30
     * @param EventDispatcherInterface $eventDispatcher Symfony event dispatcher
31
     */
32 1
    public function __construct(EventDispatcherInterface $eventDispatcher)
33
    {
34 1
        $this->eventDispatcher = $eventDispatcher;
35 1
    }
36
37
    /** {@inheritdoc} */
38 1
    public function invokeEvent(Event $event)
39
    {
40 1
        $this->eventDispatcher->dispatch($event->getType(), $event);
41 1
    }
42
}
43