EventHandlerFromSymfonyEventDispatcher   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A invokeEvent() 0 8 1
1
<?php
2
/**
3
 * Async sockets
4
 *
5
 * @copyright Copyright (c) 2015-2017, 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 AsyncSockets\Socket\SocketInterface;
14
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
15
16
/**
17
 * Class EventHandlerFromSymfonyEventDispatcher
18
 */
19
class EventHandlerFromSymfonyEventDispatcher implements EventHandlerInterface
20
{
21
    /**
22
     * EventDispatcherInterface
23
     *
24
     * @var EventDispatcherInterface
25
     */
26
    private $eventDispatcher;
27
28
    /**
29
     * EventHandlerFromSymfonyEventDispatcher constructor.
30
     *
31
     * @param EventDispatcherInterface $eventDispatcher Symfony event dispatcher
32
     */
33 1
    public function __construct(EventDispatcherInterface $eventDispatcher)
34
    {
35 1
        $this->eventDispatcher = $eventDispatcher;
36 1
    }
37
38
    /** {@inheritdoc} */
39 1
    public function invokeEvent(
40
        Event $event,
41
        RequestExecutorInterface $executor,
42
        SocketInterface $socket,
43
        ExecutionContext $context
44
    ) {
45 1
        $this->eventDispatcher->dispatch($event->getType(), $event);
46 1
    }
47
}
48