Code Duplication    Length = 19-19 lines in 2 locations

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

@@ 826-844 (lines=19) @@
823
        $form = $this->getServiceLocator()->get('playgroundgame_sharemail_form');
824
        $form->setAttribute('method', 'post');
825
    
826
        if ($this->getRequest()->isPost()) {
827
            $data = $this->getRequest()->getPost()->toArray();
828
            $form->setData($data);
829
            if ($form->isValid()) {
830
                $data['post'] = $post;
831
                $result = $this->getGameService()->sendShareMail($data, $this->game, $this->user, null, 'share-post');
832
                if ($result) {
833
                    $statusMail = true;
834
                    $this->getGameService()->addShare($post);
835
                }
836
            } else {
837
                foreach ($form->getMessages() as $el => $errors) {
838
                    foreach ($errors as $key => $message) {
839
                        $message = $this->getServiceLocator()->get('translator')->translate($message);
840
                    }
841
                }
842
            }
843
        }
844
845
        $viewModel = $this->buildView($this->game);
846
            
847
        $viewModel->setVariables(array(
@@ 869-887 (lines=19) @@
866
        $form = $this->getServiceLocator()->get('playgroundgame_sharemail_form');
867
        $form->setAttribute('method', 'post');
868
    
869
        if ($this->getRequest()->isPost()) {
870
            $data = $this->getRequest()->getPost()->toArray();
871
            $form->setData($data);
872
            if ($form->isValid()) {
873
                $data['comment'] = $comment;
874
                $subject = $this->getGameService()->getOptions()->getShareCommentSubjectLine();
875
                $result = $this->getGameService()->sendShareMail($data, $this->game, $this->user, null, 'share-comment', null, array(), $subject);
876
                if ($result) {
877
                    $statusMail = true;
878
                }
879
            } else {
880
                foreach ($form->getMessages() as $el => $errors) {
881
                    foreach ($errors as $key => $message) {
882
                        $message = $this->getServiceLocator()->get('translator')->translate($message);
883
                    }
884
                }
885
            }
886
        }
887
888
        $viewModel = $this->buildView($this->game);
889
            
890
        $viewModel->setVariables(array(