Code Duplication    Length = 77-80 lines in 2 locations

src/eXpansion/Bundle/LocalRecords/Plugins/LapsRecords.php 1 location

@@ 14-90 (lines=77) @@
11
 * @package eXpansion\Bundle\LocalRecords\Plugins;
12
 * @author  oliver de Cramer <[email protected]>
13
 */
14
class LapsRecords extends BaseRecords implements TmRaceDataListenerInterface
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
    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
    }
46
47
    /*
48
     * @inheritdoc
49
     */
50
    public function onPlayerEndLap(
51
        $login,
52
        $time,
53
        $lapTime,
54
        $stuntsScore,
55
        $cpInLap,
56
        $curLapCps,
57
        $blockId,
58
        $speed,
59
        $distance
60
    ) {
61
        if (!$this->status) {
62
            return;
63
        }
64
65
        $eventData = $this->recordsHandler->addRecord($login, $lapTime, $curLapCps);
66
        if ($eventData) {
67
            $this->dispatchEvent($eventData);
68
        }
69
    }
70
71
    /*
72
     * @inheritdoc
73
     */
74
    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
    }
90
}
91

src/eXpansion/Bundle/LocalRecords/Plugins/RaceRecords.php 1 location

@@ 13-92 (lines=80) @@
10
 * @package eXpansion\Bundle\LocalRecords\Plugins;
11
 * @author  oliver de Cramer <[email protected]>
12
 */
13
class RaceRecords extends BaseRecords implements TmRaceDataListenerInterface
14
{
15
    /**
16
     * @inheritdoc
17
     */
18
    public function startMap($map, $nbLaps)
19
    {
20
        if ($nbLaps == 1 && $map->lapRace) {
21
            $this->status = false;
22
            return;
23
        }
24
25
        parent::startMap($map, $nbLaps);
26
    }
27
28
29
    /**
30
     * @inheritdoc
31
     */
32
    public function onPlayerEndRace(
33
        $login,
34
        $time,
35
        $raceTime,
36
        $stuntsScore,
37
        $cpInRace,
38
        $curCps,
39
        $blockId,
40
        $speed,
41
        $distance
42
    )
43
    {
44
        if (!$this->status) {
45
            return;
46
        }
47
48
        $eventData = $this->recordsHandler->addRecord($login, $raceTime, $curCps);
49
        if ($eventData) {
50
            $this->dispatchEvent($eventData);
51
        }
52
    }
53
54
    /*
55
     * @inheritdoc
56
     */
57
    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
    }
71
72
    /*
73
     * @inheritdoc
74
     */
75
    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
    }
92
}
93