Completed
Pull Request — master (#129)
by
unknown
03:00
created

ChatDataProvider::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 3
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 2
1
<?php
2
3
namespace eXpansion\Framework\Core\DataProviders;
4
5
use eXpansion\Framework\Core\Storage\PlayerStorage;
6
7
/**
8
 * ChatDataProvider provides chat information to plugins.
9
 *
10
 * @package eXpansion\Framework\Core\DataProviders
11
 */
12
class ChatDataProvider extends AbstractDataProvider
13
{
14
    /** @var  PlayerStorage */
15
    protected $playerStorage;
16
17
    /**
18
     * ChatDataProvider constructor.
19
     *
20
     * @param PlayerStorage $playerStorage
21
     */
22
    public function __construct(PlayerStorage $playerStorage)
23
    {
24
        $this->playerStorage = $playerStorage;
25
    }
26
27
    /**
28
     * Called when a player chats on the server.
29
     *
30
     * @param int $playerUid
31
     * @param string $login
32
     * @param string $text
33
     * @param bool $isRegisteredCmd
34
     */
35
    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...
36
    {
37
        if (!$isRegisteredCmd) {
38
            $this->dispatch(__FUNCTION__, [$this->playerStorage->getPlayerInfo($login), $text]);
39
        }
40
    }
41
}
42