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

MapDataProvider   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A onBeginMap() 0 4 1
A onEndMap() 0 5 1
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