Code Duplication    Length = 10-10 lines in 4 locations

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

@@ 554-563 (lines=10) @@
551
        // buildView must be before sendMail because it adds the game template path to the templateStack
552
        $viewModel = $this->buildView($this->game);
553
    
554
        if ($this->getRequest()->isPost()) {
555
            $data = $this->getRequest()->getPost()->toArray();
556
            $form->setData($data);
557
            if ($form->isValid()) {
558
                $result = $this->getGameService()->sendShareMail($data, $this->game, $this->user, $lastEntry);
559
                if ($result) {
560
                    $statusMail = true;
561
                }
562
            }
563
        }
564
565
        $viewModel->setVariables(array(
566
            'statusMail'       => $statusMail,

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

@@ 785-794 (lines=10) @@
782
        $form = $this->getServiceLocator()->get('playgroundgame_sharemail_form');
783
        $form->setAttribute('method', 'post');
784
    
785
        if ($this->getRequest()->isPost()) {
786
            $data = $this->getRequest()->getPost()->toArray();
787
            $form->setData($data);
788
            if ($form->isValid()) {
789
                $result = $this->getGameService()->sendShareMail($data, $this->game, $this->user, null, 'share-post');
790
                if ($result) {
791
                    $statusMail = true;
792
                }
793
            }
794
        }
795
796
        $viewModel = $this->buildView($this->game);
797
            
@@ 818-827 (lines=10) @@
815
        $form = $this->getServiceLocator()->get('playgroundgame_sharemail_form');
816
        $form->setAttribute('method', 'post');
817
    
818
        if ($this->getRequest()->isPost()) {
819
            $data = $this->getRequest()->getPost()->toArray();
820
            $form->setData($data);
821
            if ($form->isValid()) {
822
                $result = $this->getGameService()->sendShareMail($data, $this->game, $this->user, null, 'share-comment');
823
                if ($result) {
824
                    $statusMail = true;
825
                }
826
            }
827
        }
828
829
        $viewModel = $this->buildView($this->game);
830
            
@@ 873-882 (lines=10) @@
870
        $form = $this->getServiceLocator()->get('playgroundgame_sharemail_form');
871
        $form->setAttribute('method', 'post');
872
    
873
        if ($this->getRequest()->isPost()) {
874
            $data = $this->getRequest()->getPost()->toArray();
875
            $form->setData($data);
876
            if ($form->isValid()) {
877
                $result = $this->getGameService()->sendShareMail($data, $this->game, $this->user, $lastEntry);
878
                if ($result) {
879
                    $statusMail = true;
880
                }
881
            }
882
        }
883
884
        $viewModel = $this->buildView($this->game);
885