Code Duplication    Length = 10-10 lines in 3 locations

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

@@ 441-450 (lines=10) @@
438
        $form = $this->getServiceLocator()->get('playgroundgame_sharemail_form');
439
        $form->setAttribute('method', 'post');
440
441
        if ($this->getRequest()->isPost()) {
442
            $data = $this->getRequest()->getPost()->toArray();
443
            $form->setData($data);
444
            if ($form->isValid()) {
445
                $result = $this->getGameService()->sendShareMail($data, $game, $user, $lastEntry);
446
                if ($result) {
447
                    $statusMail = true;
448
                }
449
            }
450
        }
451
452
        // Je recherche le post associé à entry + status == 0. Si non trouvé, je redirige vers home du jeu.
453
        $post = $this->getGameService()->getPostVotePostMapper()->findOneBy(array('entry' => $lastEntry));
@@ 842-851 (lines=10) @@
839
        $form = $this->getServiceLocator()->get('playgroundgame_sharemail_form');
840
        $form->setAttribute('method', 'post');
841
    
842
        if ($this->getRequest()->isPost()) {
843
            $data = $this->getRequest()->getPost()->toArray();
844
            $form->setData($data);
845
            if ($form->isValid()) {
846
                $result = $this->getGameService()->sendShareMail($data, $game, $user, $lastEntry);
847
                if ($result) {
848
                    $statusMail = true;
849
                }
850
            }
851
        }
852
853
        $viewModel = $this->buildView($game);
854
    

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

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