Code Duplication    Length = 18-18 lines in 2 locations

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

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