Code Duplication    Length = 18-18 lines in 2 locations

src/Controller/Frontend/PostVoteController.php 2 locations

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