Code Duplication    Length = 10-10 lines in 3 locations

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

@@ 314-323 (lines=10) @@
311
        $form = $this->getServiceLocator()->get('playgroundgame_sharemail_form');
312
        $form->setAttribute('method', 'post');
313
314
        if ($this->getRequest()->isPost()) {
315
            $data = $this->getRequest()->getPost()->toArray();
316
            $form->setData($data);
317
            if ($form->isValid()) {
318
                $result = $this->getGameService()->sendShareMail($data, $game, $user, $lastEntry);
319
                if ($result) {
320
                    $statusMail = true;
321
                }
322
            }
323
        }
324
325
        // Je recherche le post associé à entry + status == 0. Si non trouvé, je redirige vers home du jeu.
326
        $post = $this->getGameService()->getPostVotePostMapper()->findOneBy(array('entry' => $lastEntry));
@@ 656-665 (lines=10) @@
653
        $form = $this->getServiceLocator()->get('playgroundgame_sharemail_form');
654
        $form->setAttribute('method', 'post');
655
    
656
        if ($this->getRequest()->isPost()) {
657
            $data = $this->getRequest()->getPost()->toArray();
658
            $form->setData($data);
659
            if ($form->isValid()) {
660
                $result = $this->getGameService()->sendShareMail($data, $game, $user, $lastEntry);
661
                if ($result) {
662
                    $statusMail = true;
663
                }
664
            }
665
        }
666
667
        $viewModel = $this->buildView($game);
668
    

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

@@ 737-746 (lines=10) @@
734
        $form = $this->getServiceLocator()->get('playgroundgame_sharemail_form');
735
        $form->setAttribute('method', 'post');
736
    
737
        if ($this->getRequest()->isPost()) {
738
            $data = $this->getRequest()->getPost()->toArray();
739
            $form->setData($data);
740
            if ($form->isValid()) {
741
                $result = $this->getGameService()->sendShareMail($data, $game, $user, $lastEntry);
742
                if ($result) {
743
                    $statusMail = true;
744
                }
745
            }
746
        }
747
    
748
        // buildView must be before sendMail because it adds the game template path to the templateStack
749
        $viewModel = $this->buildView($game);