Completed
Pull Request — master (#148)
by De Cramer
02:37
created

MapDataProvider::dispatchMapEvent()   A

Complexity

Conditions 3
Paths 1

Size

Total Lines 14
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 3

Importance

Changes 0
Metric Value
dl 0
loc 14
ccs 9
cts 9
cp 1
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 8
nc 1
nop 2
crap 3
1
<?php
2
3
namespace eXpansion\Framework\GameManiaplanet\DataProviders;
4
5
use eXpansion\Framework\Core\DataProviders\AbstractDataProvider;
6
use eXpansion\Framework\Core\Storage\PlayerStorage;
7
use Maniaplanet\DedicatedServer\Connection;
8
use Maniaplanet\DedicatedServer\Structures\Map;
9
10
/**
11
 * ChatDataProvider provides chat information to plugins.
12
 *
13
 * @package eXpansion\Framework\Core\DataProviders
14
 */
15
class MapDataProvider extends AbstractDataProvider
16
{
17
    /** @var  PlayerStorage */
18
    protected $playerStorage;
19
20
    /** @var  Connection */
21
    protected $connection;
22
23
    /**
24
     * MatchDataProvider constructor.
25
     *
26
     * @param PlayerStorage $playerStorage
27
     * @param Connection $connection
28
     */
29 2
    public function __construct(PlayerStorage $playerStorage, Connection $connection)
30
    {
31 2
        $this->playerStorage = $playerStorage;
32 2
        $this->connection = $connection;
33 2
    }
34
35 1
    public function onBeginMap($map)
36
    {
37 1
        $this->dispatch(__FUNCTION__, [Map::fromArray($map)]);
38 1
    }
39
40 1
    public function onEndMap($map)
41
    {
42
43 1
        $this->dispatch(__FUNCTION__, [Map::fromArray($map)]);
44 1
    }
45
}
46