Completed
Pull Request — master (#148)
by De Cramer
02:37
created

ChatDataProvider::onPlayerChat()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 6
ccs 4
cts 4
cp 1
rs 9.4285
cc 2
eloc 3
nc 2
nop 4
crap 2
1
<?php
2
3
namespace eXpansion\Framework\GameManiaplanet\DataProviders;
4
5
use eXpansion\Framework\Core\DataProviders\AbstractDataProvider;
6
use eXpansion\Framework\Core\Storage\PlayerStorage;
7
8
/**
9
 * ChatDataProvider provides chat information to plugins.
10
 *
11
 * @package eXpansion\Framework\Core\DataProviders
12
 */
13
class ChatDataProvider extends AbstractDataProvider
14
{
15
    /** @var  PlayerStorage */
16
    protected $playerStorage;
17
18
    /**
19
     * ChatDataProvider constructor.
20
     *
21
     * @param PlayerStorage $playerStorage
22
     */
23 2
    public function __construct(PlayerStorage $playerStorage)
24
    {
25 2
        $this->playerStorage = $playerStorage;
26 2
    }
27
28
    /**
29
     * Called when a player chats on the server.
30
     *
31
     * @param int $playerUid
32
     * @param string $login
33
     * @param string $text
34
     * @param bool $isRegisteredCmd
35
     */
36 2
    public function onPlayerChat($playerUid, $login, $text, $isRegisteredCmd = false)
0 ignored issues
show
Unused Code introduced by
The parameter $playerUid is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
37
    {
38 2
        if (!$isRegisteredCmd) {
39 2
            $this->dispatch(__FUNCTION__, [$this->playerStorage->getPlayerInfo($login), $text]);
40
        }
41 2
    }
42
}
43