Completed
Pull Request — master (#59)
by De Cramer
11:04 queued 08:31
created

AbstractUserGroupPlugin   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 2
dl 0
loc 38
ccs 0
cts 14
cp 0
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A onPlayerDisconnect() 0 4 1
A onPlayerInfoChanged() 0 4 1
A onPlayerAlliesChanged() 0 4 1
1
<?php
2
3
4
namespace eXpansion\Framework\Core\Plugins\UserGroups;
5
6
use eXpansion\Framework\Core\DataProviders\Listener\PlayerDataListenerInterface;
7
use eXpansion\Framework\Core\Model\UserGroups\Group;
8
use eXpansion\Framework\Core\Storage\Data\Player;
9
10
abstract class AbstractUserGroupPlugin  implements PlayerDataListenerInterface
0 ignored issues
show
Coding Style introduced by
Expected 1 space after class name; 2 found
Loading history...
Coding Style introduced by
Expected 1 space before implements keyword; 2 found
Loading history...
11
{
12
    protected $userGroup;
13
14
    /**
15
     * AbstractUserGroupPlugin constructor.
16
     *
17
     * @param Group $userGroup
18
     */
19
    public function __construct(Group $userGroup)
20
    {
21
        $this->userGroup = $userGroup;
22
    }
23
24
    /**
25
     * @inheritdoc
26
     */
27
    public function onPlayerDisconnect(Player $player, $disconnectionReason)
28
    {
29
        $this->userGroup->removeLogin($player->getLogin());
30
    }
31
32
    /**
33
     * @inheritdoc
34
     */
35
    public function onPlayerInfoChanged(Player $oldPlayer, Player $player)
36
    {
37
        // By default nothing.
38
    }
39
40
    /**
41
     * @inheritdoc
42
     */
43
    public function onPlayerAlliesChanged(Player $oldPlayer, Player $player)
44
    {
45
        // By default nothing.
46
    }
47
}