Code Duplication    Length = 10-10 lines in 3 locations

src/PlaygroundGame/Controller/Frontend/GameController.php 1 location

@@ 501-510 (lines=10) @@
498
        $form = $this->getServiceLocator()->get('playgroundgame_sharemail_form');
499
        $form->setAttribute('method', 'post');
500
    
501
        if ($this->getRequest()->isPost()) {
502
            $data = $this->getRequest()->getPost()->toArray();
503
            $form->setData($data);
504
            if ($form->isValid()) {
505
                $result = $this->getGameService()->sendShareMail($data, $this->game, $this->user, $lastEntry);
506
                if ($result) {
507
                    $statusMail = true;
508
                }
509
            }
510
        }
511
    
512
        // buildView must be before sendMail because it adds the game template path to the templateStack
513
        $viewModel = $this->buildView($this->game);

src/PlaygroundGame/Controller/Frontend/PostVoteController.php 2 locations

@@ 346-355 (lines=10) @@
343
        $form = $this->getServiceLocator()->get('playgroundgame_sharemail_form');
344
        $form->setAttribute('method', 'post');
345
346
        if ($this->getRequest()->isPost()) {
347
            $data = $this->getRequest()->getPost()->toArray();
348
            $form->setData($data);
349
            if ($form->isValid()) {
350
                $result = $this->getGameService()->sendShareMail($data, $this->game, $this->user, $lastEntry);
351
                if ($result) {
352
                    $statusMail = true;
353
                }
354
            }
355
        }
356
357
        // Je recherche le post associé à entry + status == 0. Si non trouvé, je redirige vers home du jeu.
358
        $post = $this->getGameService()->getPostVotePostMapper()->findOneBy(array('entry' => $lastEntry));
@@ 687-696 (lines=10) @@
684
        $form = $this->getServiceLocator()->get('playgroundgame_sharemail_form');
685
        $form->setAttribute('method', 'post');
686
    
687
        if ($this->getRequest()->isPost()) {
688
            $data = $this->getRequest()->getPost()->toArray();
689
            $form->setData($data);
690
            if ($form->isValid()) {
691
                $result = $this->getGameService()->sendShareMail($data, $this->game, $this->user, $lastEntry);
692
                if ($result) {
693
                    $statusMail = true;
694
                }
695
            }
696
        }
697
698
        $viewModel = $this->buildView($this->game);
699