Completed
Pull Request — master (#80)
by De Cramer
02:23
created

MxKarma   A

Complexity

Total Complexity 18

Size/Duplication

Total Lines 251
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 18
lcom 1
cbo 2
dl 0
loc 251
ccs 0
cts 64
cp 0
rs 10
c 0
b 0
f 0

18 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 13 1
A setStatus() 0 4 1
A onStartMatchStart() 0 4 1
A onStartMatchEnd() 0 4 1
A onPlayerChat() 0 4 1
A onApplicationInit() 0 4 1
A onApplicationReady() 0 5 1
A onApplicationStop() 0 4 1
A onEndMatchStart() 0 4 1
A onEndMatchEnd() 0 4 1
A onStartTurnStart() 0 4 1
A onStartTurnEnd() 0 4 1
A onEndTurnStart() 0 4 1
A onEndTurnEnd() 0 4 1
A onStartRoundStart() 0 4 1
A onStartRoundEnd() 0 4 1
A onEndRoundStart() 0 4 1
A onEndRoundEnd() 0 4 1
1
<?php
2
3
namespace eXpansion\Bundle\MxKarma\Plugins;
4
5
6
use eXpansion\Framework\Core\DataProviders\Listener\ListenerInterfaceExpApplication;
7
use eXpansion\Framework\Core\DataProviders\Listener\ListenerInterfaceMpLegacyChat;
8
use eXpansion\Framework\Core\Helpers\ChatNotification;
9
use eXpansion\Framework\Core\Plugins\StatusAwarePluginInterface;
10
use eXpansion\Framework\Core\Services\Application\Dispatcher;
11
use eXpansion\Framework\Core\Services\Console;
12
use eXpansion\Framework\Core\Storage\Data\Player;
13
use eXpansion\Framework\GameManiaplanet\DataProviders\Listener\ListenerInterfaceMpScriptMatch;
14
use Maniaplanet\DedicatedServer\Structures\Map;
15
use Symfony\Component\Yaml\Yaml;
16
use eXpansion\Bundle\MxKarma\Plugins\Connection as MxConnection;
17
18
class MxKarma implements ListenerInterfaceMpScriptMatch, StatusAwarePluginInterface, ListenerInterfaceMpLegacyChat, ListenerInterfaceExpApplication
19
{
20
    /**
21
     * @var object
22
     */
23
    protected $config;
24
25
    /**
26
     * @var Console
27
     */
28
    protected $console;
29
    /**
30
     * @var Dispatcher
31
     */
32
    protected $dispatcher;
33
    /**
34
     * @var ChatNotification
35
     */
36
    protected $chatNotification;
37
38
    /**
39
     * @var MxConnection
40
     */
41
    private $mxKarma;
42
43
    public function __construct(
44
        MxConnection $mxKarma,
45
        Console $console,
46
        ChatNotification $chatNotification,
47
        Dispatcher $dispatcher
48
    ) {
49
50
        $this->config = (object)Yaml::parse(file_get_contents('./app/config/plugins/mxkarma.yml'))['parameters'];
51
        $this->console = $console;
52
        $this->dispatcher = $dispatcher;
53
        $this->chatNotification = $chatNotification;
54
        $this->mxKarma = $mxKarma;
55
    }
56
57
    /**
58
     * Set the status of the plugin
59
     *
60
     * @param boolean $status
61
     *
62
     * @return null
63
     */
64
    public function setStatus($status)
65
    {
66
        // TODO: Implement setStatus() method.
67
    }
68
69
    /**
70
     * Callback sent when the "StartMatch" section start.
71
     *
72
     * @param int $count Each time this section is played, this number is incremented by one
73
     * @param int $time Server time when the callback was sent
74
     *
75
     * @return mixed
76
     */
77
    public function onStartMatchStart($count, $time)
78
    {
79
        // TODO: Implement onStartMatchStart() method.
80
    }
81
82
    /**
83
     * Callback sent when the "StartMatch" section end.
84
     *
85
     * @param int $count Each time this section is played, this number is incremented by one
86
     * @param int $time Server time when the callback was sent
87
     *
88
     * @return mixed
89
     */
90
    public function onStartMatchEnd($count, $time)
91
    {
92
        // TODO: Implement onStartMatchEnd() method.
93
    }
94
95
    /**
96
     * Called when a player chats.
97
     *
98
     * @param Player $player
99
     * @param $text
100
     *
101
     * @return void
102
     */
103
    public function onPlayerChat(Player $player, $text)
104
    {
105
        // TODO: Implement onPlayerChat() method.
106
    }
107
108
    /**
109
     * called at eXpansion init
110
     *
111
     * @return void
112
     */
113
    public function onApplicationInit()
114
    {
115
        // TODO: Implement onApplicationInit() method.
116
    }
117
118
    /**
119
     * called when init is done and callbacks are enabled
120
     *
121
     * @return void
122
     */
123
    public function onApplicationReady()
124
    {
125
        $this->mxKarma->connect($this->config->serverlogin, $this->config->apikey);
126
127
    }
128
129
    /**
130
     * called when requesting application stop
131
     *
132
     * @return void
133
     */
134
    public function onApplicationStop()
135
    {
136
        // TODO: Implement onApplicationStop() method.
137
    }
138
139
    /**
140
     * Callback sent when the "EndMatch" section start.
141
     *
142
     * @param int $count Each time this section is played, this number is incremented by one
143
     * @param int $time Server time when the callback was sent
144
     *
145
     * @return mixed
146
     */
147
    public function onEndMatchStart($count, $time)
148
    {
149
        // TODO: Implement onEndMatchStart() method.
150
    }
151
152
    /**
153
     * Callback sent when the "EndMatch" section end.
154
     *
155
     * @param int $count Each time this section is played, this number is incremented by one
156
     * @param int $time Server time when the callback was sent
157
     *
158
     * @return mixed
159
     */
160
    public function onEndMatchEnd($count, $time)
161
    {
162
        // TODO: Implement onEndMatchEnd() method.
163
    }
164
165
    /**
166
     * Callback sent when the "StartTurn" section start.
167
     *
168
     * @param int $count Each time this section is played, this number is incremented by one
169
     * @param int $time Server time when the callback was sent
170
     *
171
     * @return mixed
172
     */
173
    public function onStartTurnStart($count, $time)
174
    {
175
        // TODO: Implement onStartTurnStart() method.
176
    }
177
178
    /**
179
     * Callback sent when the "StartTurn" section end.
180
     *
181
     * @param int $count Each time this section is played, this number is incremented by one
182
     * @param int $time Server time when the callback was sent
183
     *
184
     * @return mixed
185
     */
186
    public function onStartTurnEnd($count, $time)
187
    {
188
        // TODO: Implement onStartTurnEnd() method.
189
    }
190
191
    /**
192
     * Callback sent when the "EndMatch" section start.
193
     *
194
     * @param int $count Each time this section is played, this number is incremented by one
195
     * @param int $time Server time when the callback was sent
196
     *
197
     * @return mixed
198
     */
199
    public function onEndTurnStart($count, $time)
200
    {
201
        // TODO: Implement onEndTurnStart() method.
202
    }
203
204
    /**
205
     * Callback sent when the "EndMatch" section end.
206
     *
207
     * @param int $count Each time this section is played, this number is incremented by one
208
     * @param int $time Server time when the callback was sent
209
     *
210
     * @return mixed
211
     */
212
    public function onEndTurnEnd($count, $time)
213
    {
214
        // TODO: Implement onEndTurnEnd() method.
215
    }
216
217
    /**
218
     * Callback sent when the "StartRound" section start.
219
     *
220
     * @param int $count Each time this section is played, this number is incremented by one
221
     * @param int $time Server time when the callback was sent
222
     *
223
     * @return mixed
224
     */
225
    public function onStartRoundStart($count, $time)
226
    {
227
        // TODO: Implement onStartRoundStart() method.
228
    }
229
230
    /**
231
     * Callback sent when the "StartRound" section end.
232
     *
233
     * @param int $count Each time this section is played, this number is incremented by one
234
     * @param int $time Server time when the callback was sent
235
     *
236
     * @return mixed
237
     */
238
    public function onStartRoundEnd($count, $time)
239
    {
240
        // TODO: Implement onStartRoundEnd() method.
241
    }
242
243
    /**
244
     * Callback sent when the "EndMatch" section start.
245
     *
246
     * @param int $count Each time this section is played, this number is incremented by one
247
     * @param int $time Server time when the callback was sent
248
     *
249
     * @return mixed
250
     */
251
    public function onEndRoundStart($count, $time)
252
    {
253
        // TODO: Implement onEndRoundStart() method.
254
    }
255
256
    /**
257
     * Callback sent when the "EndMatch" section end.
258
     *
259
     * @param int $count Each time this section is played, this number is incremented by one
260
     * @param int $time Server time when the callback was sent
261
     *
262
     * @return mixed
263
     */
264
    public function onEndRoundEnd($count, $time)
265
    {
266
        // TODO: Implement onEndRoundEnd() method.
267
    }
268
}
269