Code Duplication    Length = 10-10 lines in 3 locations

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

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

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

@@ 436-445 (lines=10) @@
433
        $form = $this->getServiceLocator()->get('playgroundgame_sharemail_form');
434
        $form->setAttribute('method', 'post');
435
436
        if ($this->getRequest()->isPost()) {
437
            $data = $this->getRequest()->getPost()->toArray();
438
            $form->setData($data);
439
            if ($form->isValid()) {
440
                $result = $this->getGameService()->sendShareMail($data, $game, $user, $lastEntry);
441
                if ($result) {
442
                    $statusMail = true;
443
                }
444
            }
445
        }
446
447
        // Je recherche le post associé à entry + status == 0. Si non trouvé, je redirige vers home du jeu.
448
        $post = $this->getGameService()->getPostVotePostMapper()->findOneBy(array('entry' => $lastEntry));
@@ 825-834 (lines=10) @@
822
        $form = $this->getServiceLocator()->get('playgroundgame_sharemail_form');
823
        $form->setAttribute('method', 'post');
824
    
825
        if ($this->getRequest()->isPost()) {
826
            $data = $this->getRequest()->getPost()->toArray();
827
            $form->setData($data);
828
            if ($form->isValid()) {
829
                $result = $this->getGameService()->sendShareMail($data, $game, $user, $lastEntry);
830
                if ($result) {
831
                    $statusMail = true;
832
                }
833
            }
834
        }
835
836
        $viewModel = $this->buildView($game);
837