Completed
Push — dev ( 8eacd8...04be10 )
by De Cramer
02:44
created

SymfonyEventAdapter::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
ccs 3
cts 3
cp 1
cc 1
eloc 3
nc 1
nop 1
crap 1
1
<?php
2
3
namespace eXpansion\Framework\Core\Services;
4
5
use eXpansion\Framework\Core\Model\Event\DedicatedEvent;
6
use eXpansion\Framework\Core\Services\Application\DispatcherInterface;
7
use eXpansion\Framework\Core\Services\Application\EventProcessorInterface;
8
use eXpansion\Framework\Core\Storage\GameDataStorage;
9
use Maniaplanet\DedicatedServer\Connection;
10
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
11
12
/**
13
 * Class StorageProvider
14
 *
15
 * @author    de Cramer Oliver<[email protected]>
16
 * @copyright 2017 Smile
17
 * @package eXpansion\Framework\Core\Services
18
 */
19
class SymfonyEventAdapter implements EventProcessorInterface
20
{
21
    /** @var EventDispatcherInterface */
22
    protected $symfonyEventDispatcher;
23
24
    /**
25
     * SymfonyEventAdapter constructor.
26
     *
27
     * @param EventDispatcherInterface $eventDispatcher
28
     */
29 46
    public function __construct(
30
        EventDispatcherInterface $eventDispatcher
31
    ) {
32 46
        $this->symfonyEventDispatcher = $eventDispatcher;
33 46
    }
34
35
36
    /**
37
     * Dispatch event as it needs to be.
38
     *
39
     * @param string $eventName Name of the event.
40
     * @param array $params Parameters
41
     */
42 24
    public function dispatch($eventName, $params)
43
    {
44 24
        $event = new DedicatedEvent();
45 24
        $event->setParameters($params);
46 24
        $this->symfonyEventDispatcher->dispatch("maniaplanet.game." . $eventName, $event);
47
    }
48
}