Code Duplication    Length = 18-18 lines in 2 locations

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

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