Completed
Pull Request — master (#191)
by De Cramer
38:49 queued 31:55
created

LapsRecords::onPlayerWayPoint()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 16
Code Lines 13

Duplication

Lines 16
Ratio 100 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 16
loc 16
ccs 2
cts 2
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 13
nc 1
nop 12
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