PlayerDataProvider::onPlayerThrowsObject()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9

Duplication

Lines 8
Ratio 88.89 %

Code Coverage

Tests 0
CRAP Score 2

Importance

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