Code Duplication    Length = 78-81 lines in 2 locations

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

@@ 14-91 (lines=78) @@
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->logger->info("Disabling lap records.", ['map' => $map->lapRace]);
23
            $this->status = false;
24
            return;
25
        }
26
27
        parent::onStartMapStart($count, $time, $restarted, $map);
28
    }
29
30
31
    /*
32
     * @inheritdoc
33
     */
34
    public function onPlayerEndRace(
35
        $login,
36
        $time,
37
        $raceTime,
38
        $stuntsScore,
39
        $cpInRace,
40
        $curCps,
41
        $blockId,
42
        $speed,
43
        $distance
44
    ) {
45
        // Nothing to do.
46
    }
47
48
    /*
49
     * @inheritdoc
50
     */
51
    public function onPlayerEndLap(
52
        $login,
53
        $time,
54
        $lapTime,
55
        $stuntsScore,
56
        $cpInLap,
57
        $curLapCps,
58
        $blockId,
59
        $speed,
60
        $distance
61
    ) {
62
        if (!$this->status) {
63
            return;
64
        }
65
66
        $eventData = $this->recordsHandler->addRecord($login, $lapTime, $curLapCps);
67
        if ($eventData) {
68
            $this->dispatchEvent($eventData);
69
        }
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
        // Nothing to do.
90
    }
91
}
92

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

@@ 13-93 (lines=81) @@
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->logger->info("Disabling race records.", ['nbLaps' => $nbLaps, 'map' => $map->lapRace]);
22
            $this->status = false;
23
            return;
24
        }
25
26
        parent::startMap($map, $nbLaps);
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
    {
45
        if (!$this->status) {
46
            return;
47
        }
48
49
        $eventData = $this->recordsHandler->addRecord($login, $raceTime, $curCps);
50
        if ($eventData) {
51
            $this->dispatchEvent($eventData);
52
        }
53
    }
54
55
    /*
56
     * @inheritdoc
57
     */
58
    public function onPlayerEndLap(
59
        $login,
60
        $time,
61
        $lapTime,
62
        $stuntsScore,
63
        $cpInLap,
64
        $curLapCps,
65
        $blockId,
66
        $speed,
67
        $distance
68
    )
69
    {
70
        // Nothing to do.
71
    }
72
73
    /*
74
     * @inheritdoc
75
     */
76
    public function onPlayerWayPoint(
77
        $login,
78
        $time,
79
        $raceTime,
80
        $lapTime,
81
        $stuntsScore,
82
        $cpInRace,
83
        $cpInLap,
84
        $curCps,
85
        $curLapCps,
86
        $blockId,
87
        $speed,
88
        $distance
89
    )
90
    {
91
        // Nothing to do.
92
    }
93
}
94