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

RaceRecords::onPlayerWayPoint()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 17
Code Lines 13

Duplication

Lines 17
Ratio 100 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 17
loc 17
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\ListenerInterfaceRaceData;
6
7
/**
8
 * Class RaceRecords
9
 *
10
 * @package eXpansion\Bundle\LocalRecords\Plugins;
11
 * @author  oliver de Cramer <[email protected]>
12
 */
13
class RaceRecords extends BaseRecords implements ListenerInterfaceRaceData
14
{
15
    /**
16
     * @inheritdoc
17
     */
18 2
    public function onPlayerEndRace(
19
        $login,
20
        $time,
21
        $raceTime,
22
        $stuntsScore,
23
        $cpInRace,
24
        $curCps,
25
        $blockId,
26
        $speed,
27
        $distance
28
    )
29
    {
30 2
        $eventData = $this->recordsHandler->addRecord($login, $raceTime, $curCps);
31 2
        if ($eventData) {
32 1
            $this->dispatchEvent($eventData);
33
        }
34 2
    }
35
}
36