Code Duplication    Length = 18-18 lines in 2 locations

src/DP/Core/CoreBundle/Controller/Server/ServerDomainManager.php 1 location

@@ 145-162 (lines=18) @@
142
     * @param $state
143
     * @return ServerInterface|null
144
     */
145
    public function changeState(ServerInterface $server, $state)
146
    {
147
        try {
148
            $server->changeState($state);
149
        }
150
        catch (ConnectionErrorException $e) {
151
            $this->flashHelper->setFlash(
152
                ResourceEvent::TYPE_ERROR,
153
                'dedipanel.machine.connection_failed'
154
            );
155
156
            return null;
157
        }
158
159
        $this->flashHelper->setFlash(ResourceEvent::TYPE_SUCCESS, 'dedipanel.flashes.state_changed.' . $state);
160
161
        return $server;
162
    }
163
164
    protected function installationProcess(ServerInterface $server)
165
    {

src/DP/GameServer/GameServerBundle/Controller/GameServerDomainManager.php 1 location

@@ 61-78 (lines=18) @@
58
     * @param GameServer $server
59
     * @return GameServer|null
60
     */
61
    public function regenerateConfig(GameServer $server)
62
    {
63
        try {
64
            $server->regenerateScripts($this->templating);
65
        }
66
        catch (ConnectionErrorException $e) {
67
            $this->flashHelper->setFlash(
68
                ResourceEvent::TYPE_ERROR,
69
                'dedipanel.machine.connection_failed'
70
            );
71
72
            return null;
73
        }
74
75
        $this->flashHelper->setFlash(ResourceEvent::TYPE_SUCCESS, 'dedipanel.flashes.config_regenerated');
76
77
        return $server;
78
    }
79
80
    /**
81
     * Install a $plugin on $server