Code Duplication    Length = 19-21 lines in 2 locations

src/Controller/Frontend/PostVoteController.php 2 locations

@@ 717-735 (lines=19) @@
714
            $response->setContent(\Zend\Json\Json::encode(array(
715
                'success' => 0
716
            )));
717
        } else {
718
            if ($request->isPost()) {
719
                if ($this->getGameService()->addComment(
720
                    $this->user,
721
                    $this->getRequest()->getServer('REMOTE_ADDR'),
722
                    $post,
723
                    $this->params()->fromPost('comment'),
724
                    $this->params()->fromPost('category')
725
                )) {
726
                    $response->setContent(\Zend\Json\Json::encode(array(
727
                        'success' => 1
728
                    )));
729
                } else {
730
                    $response->setContent(\Zend\Json\Json::encode(array(
731
                        'success' => 0
732
                    )));
733
                }
734
            }
735
        }
736
737
        //ajax call ?
738
        if ($this->getRequest()->isXmlHttpRequest()) {
@@ 765-785 (lines=21) @@
762
            return $response;
763
        }
764
765
        if (!$this->zfcUserAuthentication()->hasIdentity()) {
766
            $response->setContent(\Zend\Json\Json::encode(array(
767
                'success' => 0
768
            )));
769
        } else {
770
            if ($request->isPost()) {
771
                if ($this->getGameService()->removeComment(
772
                    $this->user,
773
                    $this->getRequest()->getServer('REMOTE_ADDR'),
774
                    $commentId
775
                )) {
776
                    $response->setContent(\Zend\Json\Json::encode(array(
777
                        'success' => 1
778
                    )));
779
                } else {
780
                    $response->setContent(\Zend\Json\Json::encode(array(
781
                        'success' => 0
782
                    )));
783
                }
784
            }
785
        }
786
787
        return $response;
788
    }