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

__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 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