Completed
Push — master ( 7c5112...0705e2 )
by
unknown
15s
created

LapsRecords::onStartMapStart()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 9
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 9
loc 9
ccs 0
cts 6
cp 0
rs 9.6666
c 0
b 0
f 0
cc 2
eloc 5
nc 2
nop 4
crap 6
1
<?php
2
3
namespace eXpansion\Bundle\LocalRecords\Plugins;
4
5
use eXpansion\Framework\GameTrackmania\DataProviders\Listener\RaceDataListenerInterface as TmRaceDataListenerInterface;
6
use Maniaplanet\DedicatedServer\Structures\Map;
7
8
/**
9
 * Class RaceRecords
10
 *
11
 * @package eXpansion\Bundle\LocalRecords\Plugins;
12
 * @author  oliver de Cramer <[email protected]>
13
 */
14 View Code Duplication
class LapsRecords extends BaseRecords implements TmRaceDataListenerInterface
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
15
{
16
    /*
17
     * @inheritdoc
18
     */
19
    public function onStartMapStart($count, $time, $restarted, Map $map)
20
    {
21
        if (!$map->lapRace) {
22
            $this->status = false;
23
            return;
24
        }
25
26
        parent::onStartMapStart($count, $time, $restarted, $map);
27
    }
28
29
30
    /*
31
     * @inheritdoc
32
     */
33 1
    public function onPlayerEndRace(
34
        $login,
35
        $time,
36
        $raceTime,
37
        $stuntsScore,
38
        $cpInRace,
39
        $curCps,
40
        $blockId,
41
        $speed,
42
        $distance
43
    ) {
44
        // Nothing to do.
45 1
    }
46
47
    /*
48
     * @inheritdoc
49
     */
50 1
    public function onPlayerEndLap(
51
        $login,
52
        $time,
53
        $lapTime,
54
        $stuntsScore,
55
        $cpInLap,
56
        $curLapCps,
57
        $blockId,
58
        $speed,
59
        $distance
60
    ) {
61 1
        if (!$this->status) {
62
            return;
63
        }
64
65 1
        $eventData = $this->recordsHandler->addRecord($login, $lapTime, $curLapCps);
66 1
        if ($eventData) {
67 1
            $this->dispatchEvent($eventData);
68
        }
69 1
    }
70
71
    /*
72
     * @inheritdoc
73
     */
74 1
    public function onPlayerWayPoint(
75
        $login,
76
        $time,
77
        $raceTime,
78
        $lapTime,
79
        $stuntsScore,
80
        $cpInRace,
81
        $cpInLap,
82
        $curCps,
83
        $curLapCps,
84
        $blockId,
85
        $speed,
86
        $distance
87
    ) {
88
        // Nothing to do.
89 1
    }
90
}
91