Code Duplication    Length = 19-19 lines in 2 locations

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

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