Code Duplication    Length = 23-24 lines in 2 locations

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

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

@@ 115-138 (lines=24) @@
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->factory->getConnection()->{$this->functionName}($parameter);
122
            $this->chatNotification->sendMessage(
123
                $this->chatMessage,
124
                $this->isPublic ? null : $login,
125
                ['%adminLevel%' => $group, '%admin%' => $nickName, "%parameter%" => $parameter]
126
            );
127
128
            $logMessage = $this->chatNotification->getMessage($this->chatMessage,
129
                ['%adminLevel%' => $group, '%admin%' => $nickName, "%parameter%" => $parameter], "en");
130
            $this->logger->info("[".$login."] ".TMString::trimStyles($logMessage));
131
132
        } catch (DedicatedException $e) {
133
            $this->logger->error("Error on admin command", ["exception" => $e]);
134
            $this->chatNotification->sendMessage("expansion_admin_chat.dedicatedexception", $login,
135
                ["%message%" => $e->getMessage()]);
136
        }
137
138
    }
139
}
140