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

PlayerDataProvider::onPlayerHit()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 13
ccs 0
cts 11
cp 0
rs 9.4285
cc 1
eloc 10
nc 1
nop 1
crap 2
1
<?php
2
3
namespace eXpansion\Framework\GameShootmania\DataProviders;
4
5
use eXpansion\Framework\Core\DataProviders\AbstractDataProvider;
6
use eXpansion\Framework\GameShootmania\Structures\Landmark;
7
8
/**
9
 * Class PlayerDataProvider provides information to plugins about what is going on with players.
10
 *
11
 * @package eXpansion\Framework\Core\DataProviders
12
 */
13
class PlayerDataProvider extends AbstractDataProvider
14
{
15
16
    /**
17
     * Callback sent when a player is hit.
18
     *
19
     * @param $params
20
     */
21
    public function onPlayerHit($params)
22
    {
23
        $this->dispatch(__FUNCTION__, [
24
            $params['shooter'],
25
            $params['victim'],
26
            $params['weapon'],
27
            $params['damage'],
28
            $params['points'],
29
            $params['distance'],
30
            (object)$params['shooterPosition'],
31
            (object)$params['victimPosition'],
32
        ]);
33
    }
34
35
    /**
36
     * Callback sent when a player is eliminated.
37
     *
38
     * @param $params
39
     */
40 View Code Duplication
    public function onArmorEmpty($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...
41
    {
42
        $this->dispatch(__FUNCTION__, [
43
            $params['shooter'],
44
            $params['victim'],
45
            $params['weapon'],
46
            $params['distance'],
47
            (object)$params['shooterposition'],
48
            (object)$params['victimposition'],
49
        ]);
50
    }
51
52
53
    /**
54
     * @param $params
55
     */
56
    public function onCapture($params)
57
    {
58
        $landmarkObj = Landmark::fromArray($params['landmark']);
59
60
        $this->dispatch(__FUNCTION__, [
61
            $params['players'],
62
            $landmarkObj,
63
        ]);
64
    }
65
66
    /**
67
     * @param $params
68
     */
69
    public function onPlayerTriggersSector($params) {
70
        $this->dispatch(__FUNCTION__, [
71
            $params['login'],
72
            $params['sectorid'],
73
        ]);
74
    }
75
76
    /**
77
     *
78
     * @param $params
79
     */
80 View Code Duplication
    public function onPlayerTouchesObject($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...
81
        $this->dispatch(__FUNCTION__, [
82
            $params['login'],
83
            $params['objectid'],
84
            $params['modelid'],
85
            $params['modelname'],
86
        ]);
87
    }
88
89
    /**
90
     *
91
     * @param $params
92
     */
93 View Code Duplication
    public function onPlayerThrowsObject($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...
94
        $this->dispatch(__FUNCTION__, [
95
            $params['login'],
96
            $params['objectid'],
97
            $params['modelid'],
98
            $params['modelname'],
99
        ]);
100
    }
101
102
}
103