Code Duplication    Length = 23-23 lines in 2 locations

src/Comment/CommentController.php 2 locations

@@ 111-133 (lines=23) @@
108
        return $pageRender->renderPage(["title" => $title]);
109
    }
110
111
    public function newComment($id)
112
    {
113
        if ($this->di->get("session")->has("email")) {
114
            $title = "Create new comment";
115
            $view = $this->di->get("view");
116
            $pageRender = $this->di->get("pageRender");
117
            $form = new CreateCommentForm($this->di, $id);
118
119
            $form->check();
120
121
            $data = [
122
                "form" => $form->getHTML(),
123
            ];
124
125
            $view->add("comment/addNewComment", $data);
126
127
            return $pageRender->renderPage(["title" => $title]);
128
        } else {
129
            $login = $this->di->get("url")->create("user/login");
130
            $this->di->get("response")->redirect($login);
131
            return false;
132
        }
133
    }
134
135
    public function postAndComments($id)
136
    {
@@ 185-207 (lines=23) @@
182
        }
183
    }
184
185
    public function newCommentComment($idcomment, $idpost)
186
    {
187
        if ($this->di->get("session")->has("email")) {
188
            $title = "Create new comment";
189
            $view = $this->di->get("view");
190
            $pageRender = $this->di->get("pageRender");
191
            $form = new CreateCommentCommentForm($this->di, $idcomment, $idpost);
192
193
            $form->check();
194
195
            $data = [
196
                "form" => $form->getHTML(),
197
            ];
198
199
            $view->add("comment/addNewComment", $data);
200
201
            return $pageRender->renderPage(["title" => $title]);
202
        } else {
203
            $login = $this->di->get("url")->create("user/login");
204
            $this->di->get("response")->redirect($login);
205
            return false;
206
        }
207
    }
208
209
    public function deleteCommentComment($id, $nested = false)
210
    {