Code Duplication    Length = 39-40 lines in 3 locations

src/eXpansion/Bundle/AdminChat/ChatCommand/SetServerName.php 1 location

@@ 14-52 (lines=39) @@
11
 * @package eXpansion\Bundle\AdminChat\ChatCommand;
12
 * @author oliver de Cramer <[email protected]>
13
 */
14
class SetServerName extends AbstractConnectionCommand
15
{
16
    /**
17
     * @inheritdoc
18
     */
19
    protected function configure()
20
    {
21
        parent::configure();
22
23
        $this->inputDefinition->addArgument(
24
            new InputArgument('name', InputArgument::REQUIRED, 'New name to give to the server')
25
        );
26
    }
27
28
    /**
29
     * @inheritdoc
30
     */
31
    public function getDescription()
32
    {
33
        return 'expansion_admin_chat.set_server_name.description';
34
    }
35
36
37
    /**
38
     * @inheritdoc
39
     */
40
    public function execute($login, InputInterface $input)
41
    {
42
        $nickName = $this->playerStorage->getPlayerInfo($login)->getNickName();
43
        $name = $input->getArgument('name');
44
45
        $this->chatNotification->sendMessage(
46
            'expansion_admin_chat.set_server_name.msg',
47
            null,
48
            ['%admin%' => $nickName, '%servername%' => $name]
49
        );
50
        $this->connection->setServerName($name);
51
    }
52
}
53

src/eXpansion/Bundle/AdminChat/ChatCommand/Unban.php 1 location

@@ 14-53 (lines=40) @@
11
 * @package eXpansion\Bundle\AdminChat\ChatCommand;
12
 * @author reaby
13
 */
14
class Unban extends AbstractConnectionCommand
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

src/eXpansion/Bundle/AdminChat/ChatCommand/Unblack.php 1 location

@@ 14-53 (lines=40) @@
11
 * @package eXpansion\Bundle\AdminChat\ChatCommand;
12
 * @author reaby
13
 */
14
class Unblack extends AbstractConnectionCommand
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 unblack.')
25
        );
26
27
    }
28
29
    /**
30
     * @inheritdoc
31
     */
32
    public function getDescription()
33
    {
34
        return 'expansion_admin_chat.unblack.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.unblack.msg',
47
            null,
48
            ['%admin%' => $nickName, '%player%' => $playerLogin]
49
        );
50
51
        $this->connection->unBlackList($playerLogin);
52
    }
53
}
54