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

RaceRecords::startMap()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 9
Ratio 100 %

Code Coverage

Tests 4
CRAP Score 3.3332

Importance

Changes 0
Metric Value
dl 9
loc 9
ccs 4
cts 6
cp 0.6667
rs 9.6666
c 0
b 0
f 0
cc 3
eloc 5
nc 2
nop 2
crap 3.3332
1
<?php
2
3
namespace eXpansion\Bundle\LocalRecords\Plugins;
4
5
use eXpansion\Framework\GameTrackmania\DataProviders\Listener\RaceDataListenerInterface as TmRaceDataListenerInterface;
6
7
/**
8
 * Class RaceRecords
9
 *
10
 * @package eXpansion\Bundle\LocalRecords\Plugins;
11
 * @author  oliver de Cramer <[email protected]>
12
 */
13 View Code Duplication
class RaceRecords 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...
14
{
15
    /**
16
     * @inheritdoc
17
     */
18 2
    public function startMap($map, $nbLaps)
19
    {
20 2
        if ($nbLaps == 1 && $map->lapRace) {
21
            $this->status = false;
22
            return;
23
        }
24
25 2
        parent::startMap($map, $nbLaps);
26 2
    }
27
28
29
    /**
30
     * @inheritdoc
31
     */
32 2
    public function onPlayerEndRace(
33
        $login,
34
        $time,
35
        $raceTime,
36
        $stuntsScore,
37
        $cpInRace,
38
        $curCps,
39
        $blockId,
40
        $speed,
41
        $distance
42
    )
43
    {
44 2
        if (!$this->status) {
45
            return;
46
        }
47
48 2
        $eventData = $this->recordsHandler->addRecord($login, $raceTime, $curCps);
49 2
        if ($eventData) {
50 1
            $this->dispatchEvent($eventData);
51
        }
52 2
    }
53
54
    /*
55
     * @inheritdoc
56
     */
57 1
    public function onPlayerEndLap(
58
        $login,
59
        $time,
60
        $lapTime,
61
        $stuntsScore,
62
        $cpInLap,
63
        $curLapCps,
64
        $blockId,
65
        $speed,
66
        $distance
67
    )
68
    {
69
        // Nothing to do.
70 1
    }
71
72
    /*
73
     * @inheritdoc
74
     */
75 1
    public function onPlayerWayPoint(
76
        $login,
77
        $time,
78
        $raceTime,
79
        $lapTime,
80
        $stuntsScore,
81
        $cpInRace,
82
        $cpInLap,
83
        $curCps,
84
        $curLapCps,
85
        $blockId,
86
        $speed,
87
        $distance
88
    )
89
    {
90
        // Nothing to do.
91 1
    }
92
}
93