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

ChatDataProvider   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
c 0
b 0
f 0
lcom 1
cbo 2
dl 0
loc 30
ccs 7
cts 7
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A onPlayerChat() 0 6 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