Code Duplication    Length = 17-21 lines in 8 locations

src/Controller/Frontend/LotteryController.php 4 locations

@@ 120-136 (lines=17) @@
117
        return $viewModel;
118
    }
119
120
    public function fbshareAction()
121
    {
122
        $result = parent::fbshareAction();
123
        $bonusEntry = false;
124
125
        if ($result->getVariable('success')) {
126
            $bonusEntry = $this->getGameService()->addAnotherChance($this->game, $this->user, 1);
127
        }
128
129
        $response = $this->getResponse();
130
        $response->setContent(\Zend\Json\Json::encode(array(
131
            'success' => $result,
132
            'playBonus' => $bonusEntry
133
         )));
134
135
        return $response;
136
    }
137
138
    public function fbrequestAction()
139
    {
@@ 138-154 (lines=17) @@
135
        return $response;
136
    }
137
138
    public function fbrequestAction()
139
    {
140
        $result = parent::fbrequestAction();
141
        $bonusEntry = false;
142
143
        if ($result->getVariable('success')) {
144
            $bonusEntry = $this->getGameService()->addAnotherChance($this->game, $this->user, 1);
145
        }
146
147
        $response = $this->getResponse();
148
        $response->setContent(\Zend\Json\Json::encode(array(
149
            'success' => $result,
150
            'playBonus' => $bonusEntry
151
        )));
152
153
        return $response;
154
    }
155
156
    public function tweetAction()
157
    {
@@ 156-172 (lines=17) @@
153
        return $response;
154
    }
155
156
    public function tweetAction()
157
    {
158
        $result = parent::tweetAction();
159
        $bonusEntry = false;
160
161
        if ($result->getVariable('success')) {
162
            $bonusEntry = $this->getGameService()->addAnotherChance($this->game, $this->user, 1);
163
        }
164
165
        $response = $this->getResponse();
166
        $response->setContent(\Zend\Json\Json::encode(array(
167
            'success' => $result,
168
            'playBonus' => $bonusEntry
169
        )));
170
171
        return $response;
172
    }
173
174
    public function googleAction()
175
    {
@@ 174-190 (lines=17) @@
171
        return $response;
172
    }
173
174
    public function googleAction()
175
    {
176
        $result = parent::googleAction();
177
        $bonusEntry = false;
178
179
        if ($result->getVariable('success')) {
180
            $bonusEntry = $this->getGameService()->addAnotherChance($this->game, $this->user, 1);
181
        }
182
183
        $response = $this->getResponse();
184
        $response->setContent(\Zend\Json\Json::encode(array(
185
            'success' => $result,
186
            'playBonus' => $bonusEntry
187
        )));
188
189
        return $response;
190
    }
191
192
    public function getGameService()
193
    {

src/Controller/Frontend/MemoryController.php 4 locations

@@ 142-162 (lines=21) @@
139
        return $viewModel;
140
    }
141
142
    public function fbshareAction()
143
    {
144
        $result = parent::fbshareAction();
145
        $bonusEntry = false;
146
147
        if ($result->getVariable('success')) {
148
            $bonusEntry = $this->getGameService()->addAnotherChance($this->game, $this->user, 1);
149
        }
150
151
        $response = $this->getResponse();
152
        $response->setContent(
153
            \Zend\Json\Json::encode(
154
                array(
155
                    'success' => $result,
156
                    'playBonus' => $bonusEntry
157
                )
158
            )
159
        );
160
161
        return $response;
162
    }
163
164
    public function fbrequestAction()
165
    {
@@ 164-180 (lines=17) @@
161
        return $response;
162
    }
163
164
    public function fbrequestAction()
165
    {
166
        $result = parent::fbrequestAction();
167
        $bonusEntry = false;
168
169
        if ($result->getVariable('success')) {
170
            $bonusEntry = $this->getGameService()->addAnotherChance($this->game, $this->user, 1);
171
        }
172
173
        $response = $this->getResponse();
174
        $response->setContent(\Zend\Json\Json::encode(array(
175
            'success' => $result,
176
            'playBonus' => $bonusEntry
177
        )));
178
179
        return $response;
180
    }
181
182
    public function tweetAction()
183
    {
@@ 182-198 (lines=17) @@
179
        return $response;
180
    }
181
182
    public function tweetAction()
183
    {
184
        $result = parent::tweetAction();
185
        $bonusEntry = false;
186
187
        if ($result->getVariable('success')) {
188
            $bonusEntry = $this->getGameService()->addAnotherChance($this->game, $this->user, 1);
189
        }
190
191
        $response = $this->getResponse();
192
        $response->setContent(\Zend\Json\Json::encode(array(
193
            'success' => $result,
194
            'playBonus' => $bonusEntry
195
        )));
196
197
        return $response;
198
    }
199
200
    public function googleAction()
201
    {
@@ 200-216 (lines=17) @@
197
        return $response;
198
    }
199
200
    public function googleAction()
201
    {
202
        $result = parent::googleAction();
203
        $bonusEntry = false;
204
205
        if ($result->getVariable('success')) {
206
            $bonusEntry = $this->getGameService()->addAnotherChance($this->game, $this->user, 1);
207
        }
208
209
        $response = $this->getResponse();
210
        $response->setContent(\Zend\Json\Json::encode(array(
211
            'success' => $result,
212
            'playBonus' => $bonusEntry
213
        )));
214
215
        return $response;
216
    }
217
218
    public function getGameService()
219
    {