Code Duplication    Length = 18-19 lines in 3 locations

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

@@ 20-37 (lines=18) @@
17
    /**
18
     * @inheritdoc
19
     */
20
    public function execute($login, InputInterface $input)
21
    {
22
        $nickName = $this->playerStorage->getPlayerInfo($login)->getNickName();
23
        $group = $this->getGroupLabel($login);
24
        try {
25
            $return = $this->connection->{$this->functionName}();
26
27
            $this->chatNotification->sendMessage(
28
                $this->chatMessage,
29
                $this->isPublic ? null : $login,
30
                ['%adminLevel%' => $group, '%admin%' => $nickName, '%return%' => $return]
31
            );
32
        }  catch (DedicatedException $e) {
33
            $this->logger->error("Error on admin command", ["exception" => $e]);
34
            $this->chatNotification->sendMessage("expansion_admin_chat.dedicatedexception", $login,
35
                ["%message%" => $e->getMessage()]);
36
        }
37
    }
38
}
39

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

@@ 115-133 (lines=19) @@
112
    /**
113
     * @inheritdoc
114
     */
115
    public function execute($login, InputInterface $input)
116
    {
117
        $nickName = $this->playerStorage->getPlayerInfo($login)->getNickName();
118
        $parameter = $input->getArgument('parameter');
119
        $group = $this->getGroupLabel($login);
120
        try {
121
            $this->connection->{$this->functionName}($parameter);
122
            $this->chatNotification->sendMessage(
123
                $this->chatMessage,
124
                $this->isPublic ? null : $login,
125
                ['%adminLevel%' => $group, '%admin%' => $nickName, "%parameter%" => $parameter]
126
            );
127
        }  catch (DedicatedException $e) {
128
            $this->logger->error("Error on admin command", ["exception" => $e]);
129
            $this->chatNotification->sendMessage("expansion_admin_chat.dedicatedexception", $login,
130
                ["%message%" => $e->getMessage()]);
131
        }
132
133
    }
134
}
135

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

@@ 68-85 (lines=18) @@
65
    /**
66
     * @inheritdoc
67
     */
68
    public function execute($login, InputInterface $input)
69
    {
70
        $nickName = $this->playerStorage->getPlayerInfo($login)->getNickName();
71
        $parameter = $this->timeHelper->textToTime($input->getArgument('parameter'));
72
        $group = $this->getGroupLabel($login);
73
        try {
74
            $this->connection->{$this->functionName}($parameter);
75
            $this->chatNotification->sendMessage(
76
                $this->chatMessage,
77
                $this->isPublic ? null : $login,
78
                ['%adminLevel%' => $group, '%admin%' => $nickName, "%parameter%" => $parameter]
79
            );
80
        }  catch (DedicatedException $e) {
81
            $this->logger->error("Error on admin command", ["exception" => $e]);
82
            $this->chatNotification->sendMessage("expansion_admin_chat.dedicatedexception", $login,
83
                ["%message%" => $e->getMessage()]);
84
        }
85
    }
86
87
    /**
88
     * @param string $parameterDescription