Completed
Pull Request — master (#22)
by De Cramer
02:18
created

MatchDataProvider::onBeginRound()   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 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace eXpansion\Core\DataProviders;
4
5
use eXpansion\Core\Storage\PlayerStorage;
6
use Maniaplanet\DedicatedServer\Connection;
7
use Maniaplanet\DedicatedServer\Structures\Map;
8
9
/**
10
 * ChatDataProvider provides chat information to plugins.
11
 *
12
 * @package eXpansion\Core\DataProviders
13
 */
14
class MatchDataProvider extends AbstractDataProvider
15
{
16
    /** @var  PlayerStorage */
17
    protected $playerStorage;
18
19
20
    /** @var  Connection */
21
    protected $connection;
22
23
    /**
24
     * MatchDataProvider constructor.
25
     *
26
     * @param PlayerStorage $playerStorage
27
     * @param Connection $connection
28
     */
29 9
    public function __construct(PlayerStorage $playerStorage, Connection $connection)
30
    {
31 9
        $this->playerStorage = $playerStorage;
32 9
        $this->connection = $connection;
33 9
    }
34
35 1
    public function onBeginMatch()
36
    {
37 1
        $this->dispatch(__FUNCTION__, []);
38 1
    }
39
40 1
    public function onEndMatch()
41
    {
42 1
        $this->dispatch(__FUNCTION__, []);
43 1
    }
44
45 1
    public function onBeginMap($map)
46
    {
47 1
        $this->dispatch(__FUNCTION__, [Map::fromArray($map)]);
48 1
    }
49
50 1
    public function onEndMap($map)
51
    {
52
53 1
        $this->dispatch(__FUNCTION__, [Map::fromArray($map)]);
54 1
    }
55
56 1
    public function onBeginRound()
57
    {
58 1
        $this->dispatch(__FUNCTION__, []);
59 1
    }
60
61 1
    public function onEndRound()
62
    {
63 1
        $this->dispatch(__FUNCTION__, []);
64 1
    }
65
66
    /**
67
     * @param $uid
68
     * @param $login
69
     * @param $data
70
     */
71 1
    public function onPlayerFinish($uid, $login, $data)
0 ignored issues
show
Unused Code introduced by
The parameter $uid is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
72
    {
73 1
        $this->dispatch(__FUNCTION__, [$this->playerStorage->getPlayerInfo($login), (float) $data]);
74 1
    }
75
76
    /**
77
     * @param $uid
78
     * @param $login
79
     * @param $time
80
     * @param $currentLap
81
     * @param $index
82
     */
83 1
    public function onPlayerCheckpoint($uid, $login, $time, $currentLap, $index)
0 ignored issues
show
Unused Code introduced by
The parameter $uid is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
84
    {
85 1
        $this->dispatch(__FUNCTION__, [$this->playerStorage->getPlayerInfo($login), (float) $time, (int) $currentLap, (int) $index]);
86 1
    }
87
88
89
}
90