Code Duplication    Length = 23-24 lines in 2 locations

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

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

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

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