Code Duplication    Length = 18-18 lines in 2 locations

src/Controller/Frontend/PostVoteController.php 2 locations

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