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

MatchDataProvider::onEndMatch()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 0
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 2
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 1
    public function __construct(PlayerStorage $playerStorage, Connection $connection)
30
    {
31 1
        $this->playerStorage = $playerStorage;
32 1
        $this->connection = $connection;
33 1
    }
34
35
    public function onRun()
36
    {
37
38
    }
39
40
    public function onBeginMatch()
41
    {
42
        $this->dispatch(__FUNCTION__, []);
43
    }
44
45
    public function onEndMatch()
46
    {
47
        $this->dispatch(__FUNCTION__, []);
48
    }
49
50
    public function onBeginMap($map)
51
    {
52
        $this->dispatch(__FUNCTION__, [Map::fromArray($map)]);
53
    }
54
55
    public function onEndMap($map)
56
    {
57
58
        $this->dispatch(__FUNCTION__, [Map::fromArray($map)]);
59
    }
60
61
    public function onBeginRound()
62
    {
63
        $this->dispatch(__FUNCTION__, []);
64
    }
65
66
    public function onEndRound()
67
    {
68
        $this->dispatch(__FUNCTION__, []);
69
    }
70
71
    /**
72
     * @param $uid
73
     * @param $login
74
     * @param $data
75
     */
76
    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...
77
    {
78
        $this->dispatch(__FUNCTION__, [$this->playerStorage->getPlayerInfo($login), (float) $data]);
79
    }
80
81
    /**
82
     * @param $uid
83
     * @param $login
84
     * @param $time
85
     * @param $currentLap
86
     * @param $index
87
     */
88
    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...
89
    {
90
        $this->dispatch(__FUNCTION__, [$this->playerStorage->getPlayerInfo($login), (float) $time, (int) $currentLap, (int) $index]);
91
    }
92
93
94
}
95