Code Duplication    Length = 10-10 lines in 3 locations

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

@@ 481-490 (lines=10) @@
478
        $form = $this->getServiceLocator()->get('playgroundgame_sharemail_form');
479
        $form->setAttribute('method', 'post');
480
    
481
        if ($this->getRequest()->isPost()) {
482
            $data = $this->getRequest()->getPost()->toArray();
483
            $form->setData($data);
484
            if ($form->isValid()) {
485
                $result = $this->getGameService()->sendShareMail($data, $this->game, $user, $lastEntry);
486
                if ($result) {
487
                    $statusMail = true;
488
                }
489
            }
490
        }
491
    
492
        // buildView must be before sendMail because it adds the game template path to the templateStack
493
        $viewModel = $this->buildView($this->game);

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

@@ 387-396 (lines=10) @@
384
        $form = $this->getServiceLocator()->get('playgroundgame_sharemail_form');
385
        $form->setAttribute('method', 'post');
386
387
        if ($this->getRequest()->isPost()) {
388
            $data = $this->getRequest()->getPost()->toArray();
389
            $form->setData($data);
390
            if ($form->isValid()) {
391
                $result = $this->getGameService()->sendShareMail($data, $this->game, $user, $lastEntry);
392
                if ($result) {
393
                    $statusMail = true;
394
                }
395
            }
396
        }
397
398
        // Je recherche le post associé à entry + status == 0. Si non trouvé, je redirige vers home du jeu.
399
        $post = $this->getGameService()->getPostVotePostMapper()->findOneBy(array('entry' => $lastEntry));
@@ 745-754 (lines=10) @@
742
        $form = $this->getServiceLocator()->get('playgroundgame_sharemail_form');
743
        $form->setAttribute('method', 'post');
744
    
745
        if ($this->getRequest()->isPost()) {
746
            $data = $this->getRequest()->getPost()->toArray();
747
            $form->setData($data);
748
            if ($form->isValid()) {
749
                $result = $this->getGameService()->sendShareMail($data, $this->game, $user, $lastEntry);
750
                if ($result) {
751
                    $statusMail = true;
752
                }
753
            }
754
        }
755
756
        $viewModel = $this->buildView($this->game);
757