Completed
Push — dev ( 04be10...0e3c94 )
by
unknown
11:22
created

Unban::configure()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 4

Duplication

Lines 9
Ratio 100 %

Importance

Changes 0
Metric Value
dl 9
loc 9
rs 9.6666
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
3
namespace eXpansion\Bundle\AdminChat\ChatCommand;
4
5
use Symfony\Component\Console\Input\InputArgument;
6
use Symfony\Component\Console\Input\InputInterface;
7
8
/**
9
 * Class Unban
10
 *
11
 * @package eXpansion\Bundle\AdminChat\ChatCommand;
12
 * @author reaby
13
 */
14 View Code Duplication
class Unban extends AbstractConnectionCommand
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
15
{
16
    /**
17
     * @inheritdoc
18
     */
19
    protected function configure()
20
    {
21
        parent::configure();
22
23
        $this->inputDefinition->addArgument(
24
            new InputArgument('login', InputArgument::REQUIRED, 'Login of player to unban.')
25
        );
26
27
    }
28
29
    /**
30
     * @inheritdoc
31
     */
32
    public function getDescription()
33
    {
34
        return 'expansion_admin_chat.unban.description';
35
    }
36
37
    /**
38
     * @inheritdoc
39
     */
40
    public function execute($login, InputInterface $input)
41
    {
42
        $nickName = $this->playerStorage->getPlayerInfo($login)->getNickName();
43
        $playerLogin = $input->getArgument('login');
44
45
        $this->chatNotification->sendMessage(
46
            'expansion_admin_chat.unban.msg',
47
            null,
48
            ['%admin%' => $nickName, '%player%' => $playerLogin]
49
        );
50
51
        $this->connection->unBan($playerLogin);
52
    }
53
}
54