Completed
Push — master ( f31586...66eb65 )
by De Cramer
04:28
created

LapsRecords::onPlayerEndRace()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 10

Duplication

Lines 13
Ratio 100 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 13
loc 13
ccs 2
cts 2
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 10
nc 1
nop 9
crap 1

How to fix   Many Parameters   

Many Parameters

Methods with many parameters are not only hard to understand, but their parameters also often become inconsistent when you need more, or different data.

There are several approaches to avoid long parameter lists:

1
<?php
2
3
namespace eXpansion\Bundle\LocalRecords\Plugins;
4
5
use eXpansion\Framework\GameTrackmania\DataProviders\Listener\ListenerInterfaceLapData;
6
7
/**
8
 * Class RaceRecords
9
 *
10
 * @package eXpansion\Bundle\LocalRecords\Plugins;
11
 * @author  oliver de Cramer <[email protected]>
12
 */
13
class LapsRecords extends BaseRecords implements ListenerInterfaceLapData
14
{
15
    /*
16
     * @inheritdoc
17
     */
18 1
    public function onPlayerEndLap(
19
        $login,
20
        $time,
21
        $lapTime,
22
        $stuntsScore,
23
        $cpInLap,
24
        $curLapCps,
25
        $blockId,
26
        $speed,
27
        $distance
28
    ) {
29 1
        $eventData = $this->recordsHandler->addRecord($login, $lapTime, $curLapCps);
30 1
        if ($eventData) {
31 1
            $this->dispatchEvent($eventData);
32
        }
33 1
    }
34
}
35