Code Duplication    Length = 8-9 lines in 3 locations

src/PlaygroundGame/Controller/Admin/InstantWinController.php 3 locations

@@ 218-225 (lines=8) @@
215
            $data['value'] = $value->format('Y-m-d H:i:s');
216
            
217
            $occurrence = $service->updateOccurrence($data, $occurrence->getId());
218
            if ($occurrence) {
219
                // Redirect to list of games
220
                $this->flashMessenger()->setNamespace('playgroundgame')->addMessage('The occurrence was created');
221
                return $this->redirect()->toRoute(
222
                    'admin/playgroundgame/instantwin-occurrence-list',
223
                    array('gameId'=>$gameId)
224
                );
225
            }
226
        }
227
        return $viewModel->setVariables(
228
            array(
@@ 282-290 (lines=9) @@
279
            if ($form->isValid()) {
280
                $data = $form->getData();
281
                $created = $this->getAdminGameService()->importOccurrences($data);
282
                if ($created) {
283
                    $this->flashMessenger()->setNamespace('playgroundgame')->addMessage(
284
                        $created.' occurrences were created !'
285
                    );
286
                    return $this->redirect()->toRoute(
287
                        'admin/playgroundgame/instantwin-occurrence-list',
288
                        array('gameId'=>$gameId)
289
                    );
290
                }
291
            }
292
        }
293
@@ 342-349 (lines=8) @@
339
            );
340
            $occurrence = $service->updateOccurrence($data, $occurrence->getId());
341
342
            if ($occurrence) {
343
                // Redirect to list of games
344
                $this->flashMessenger()->setNamespace('playgroundgame')->addMessage('The occurrence was edited');
345
                return $this->redirect()->toRoute(
346
                    'admin/playgroundgame/instantwin-occurrence-list',
347
                    array('gameId'=>$gameId)
348
                );
349
            }
350
        }
351
        return $viewModel->setVariables(
352
            array(