Completed
Pull Request — master (#210)
by
unknown
03:50
created

PlayerExtraDataProvider   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 46
Duplicated Lines 26.09 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 4
c 0
b 0
f 0
lcom 1
cbo 1
dl 12
loc 46
ccs 0
cts 19
cp 0
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A onNearMiss() 12 12 1
A onShotDeny() 0 5 1
A onFallDamage() 0 4 1
A onRequestRespawn() 0 3 1

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\GameShootmania\DataProviders;
4
5
use eXpansion\Framework\Core\DataProviders\AbstractDataProvider;
6
7
/**
8
 * Class PlayerDataProvider provides information to plugins about what is going on with players.
9
 *
10
 * @package eXpansion\Framework\Core\DataProviders
11
 */
12
class PlayerExtraDataProvider extends AbstractDataProvider
13
{
14
15
    /**
16
     * @param $params
17
     */
18 View Code Duplication
    public function onNearMiss($params)
0 ignored issues
show
Duplication introduced by
This method 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...
19
    {
20
        $this->dispatch(__FUNCTION__,
21
            [
22
                $params['shooter'],
23
                $params['victim'],
24
                $params['weapon'],
25
                $params['distance'],
26
                (object)$params['shooterposition'],
27
                (object)$params['victimposition'],
28
            ]);
29
    }
30
31
    /**
32
     * @param $params
33
     */
34
    public function onShotDeny($params)
35
    {
36
        $this->dispatch(__FUNCTION__,
37
            [$params['shooter'], $params['victim'], $params['shooterweapon'], $params['victimweapon']]);
38
    }
39
40
41
    /**
42
     * @param $params
43
     */
44
    public function onFallDamage($params)
45
    {
46
        $this->dispatch(__FUNCTION__, [$params['login']]);
47
    }
48
49
    /**
50
     * @param $params
51
     */
52
    public function onRequestRespawn($params) {
53
        $this->dispatch(__FUNCTION__, [$params['login']]);
54
    }
55
56
57
}
58