Completed
Push — dev ( 8eacd8...04be10 )
by De Cramer
02:44
created

BaseDataProvider   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 59
Duplicated Lines 54.24 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 32
loc 59
rs 10
c 0
b 0
f 0
ccs 0
cts 40
cp 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A onWayPoint() 32 55 3

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace eXpansion\Framework\GameTrackmania\DataProviders;
4
5
use eXpansion\Framework\Core\DataProviders\AbstractDataProvider;
6
7
8
/**
9
 * Class BaseDataProvider
10
 *
11
 * @package eXpansion\Framework\GameTrackmania\DataProviders;
12
 * @author  oliver de Cramer <[email protected]>
13
 */
14
class BaseDataProvider extends AbstractDataProvider
15
{
16
    public function onWayPoint($params)
17
    {
18 View Code Duplication
        if ($params['isendrace']) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across 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...
19
            $this->dispatch(
20
                'onPlayerEndRace',
21
                [
22
                    $params['login'],
23
                    $params['time'],
24
                    $params['racetime'],
25
                    $params['stuntsscore'],
26
                    $params['checkpointinrace'],
27
                    $params['curracecheckpoints'],
28
                    $params['blockid'],
29
                    $params['speed'],
30
                    $params['distance'],
31
                ]
32
            );
33
        }
34
35 View Code Duplication
        if ($params['isendlap']) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across 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...
36
            $this->dispatch(
37
                'onPlayerEndLap',
38
                [
39
                    $params['login'],
40
                    $params['time'],
41
                    $params['laptime'],
42
                    $params['stuntsscore'],
43
                    $params['checkpointinlap'],
44
                    $params['curlapcheckpoints'],
45
                    $params['blockid'],
46
                    $params['speed'],
47
                    $params['distance'],
48
                ]
49
            );
50
        }
51
52
        $this->dispatch(
53
            'onPlayerWayPoint',
54
            [
55
                $params['login'],
56
                $params['time'],
57
                $params['racetime'],
58
                $params['laptime'],
59
                $params['stuntsscore'],
60
                $params['checkpointinrace'],
61
                $params['checkpointinlap'],
62
                $params['curracecheckpoints'],
63
                $params['curlapcheckpoints'],
64
                $params['blockid'],
65
                $params['speed'],
66
                $params['distance'],
67
            ]
68
        );
69
70
    }
71
72
}