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

@@ 840-849 (lines=10) @@
837
        $form = $this->getServiceLocator()->get('playgroundgame_sharemail_form');
838
        $form->setAttribute('method', 'post');
839
    
840
        if ($this->getRequest()->isPost()) {
841
            $data = $this->getRequest()->getPost()->toArray();
842
            $form->setData($data);
843
            if ($form->isValid()) {
844
                $result = $this->getGameService()->sendShareMail($data, $game, $user, $lastEntry);
845
                if ($result) {
846
                    $statusMail = true;
847
                }
848
            }
849
        }
850
    
851
        // buildView must be before sendMail because it adds the game template path to the templateStack
852
        $viewModel = $this->buildView($game);