Completed
Pull Request — master (#191)
by De Cramer
04:00
created

RaceDataProvider::onWayPoint()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 19
Code Lines 13

Duplication

Lines 19
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 19
loc 19
rs 9.4285
c 0
b 0
f 0
ccs 0
cts 14
cp 0
cc 2
eloc 13
nc 2
nop 1
crap 6
1
<?php
2
3
namespace eXpansion\Framework\GameTrackmania\DataProviders\ScriptBaseRounds;
4
5
use eXpansion\Framework\Core\DataProviders\AbstractDataProvider;
6
use eXpansion\Framework\Core\Model\CompatibilityCheckDataProviderInterface;
7
use Maniaplanet\DedicatedServer\Structures\Map;
8
9
/**
10
 * Class RaceDataProvider
11
 *
12
 * @author    de Cramer Oliver<[email protected]>
13
 * @copyright 2017 Smile
14
 * @package eXpansion\Framework\GameTrackmania\DataProviders\ScriptBaseRounds
15
 */
16 View Code Duplication
class RaceDataProvider extends AbstractDataProvider implements CompatibilityCheckDataProviderInterface
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
17
{
18
    /**
19
     * Check if data provider is compatible with current situation.
20
     *
21
     * @return bool
22
     */
23
    public function isCompatible(Map $map): bool
24
    {
25
        return !$map->lapRace;
26
    }
27
28
29
    public function onWayPoint($params)
30
    {
31
        if ($params['isendrace']) {
32
            $this->dispatch(
33
                'onPlayerEndRace',
34
                [
35
                    $params['login'],
36
                    $params['time'],
37
                    $params['racetime'],
38
                    $params['stuntsscore'],
39
                    $params['checkpointinrace'],
40
                    $params['curracecheckpoints'],
41
                    $params['blockid'],
42
                    $params['speed'],
43
                    $params['distance'],
44
                ]
45
            );
46
        }
47
    }
48
}
49