Passed
Push — master ( f544e7...a87104 )
by Nicklas
02:21
created

CommentController   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 23
Duplicated Lines 56.52 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 1
lcom 1
cbo 2
dl 13
loc 23
ccs 0
cts 8
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getPostCreateComment() 13 13 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace Nicklas\Comment;
4
5
use \Nicklas\Comment\HTMLForm\Comment\CreateQuestionForm;
6
use \Nicklas\Comment\HTMLForm\Comment\EditCommentForm;
7
8
use \Nicklas\Comment\Modules\Question;
9
10
/**
11
 * Extends the UserController, for comments
12
 */
13
class CommentController extends AdminController
14
{
15
16
17
    /**
18
     * Shows the post(question or answer) and create comment form
19
     *
20
     * @return void
21
     */
22 View Code Duplication
    public function getPostCreateComment($id)
0 ignored issues
show
Unused Code introduced by
The parameter $id is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
23
    {
24
        $question = new Question($this->di->get("db"));
25
26
        $views = [
27
            ["comment/question/view-all", ["questions" => $question->getQuestions()], "main"]
28
        ];
29
30
        $this->di->get("pageRenderComment")->renderPage([
31
            "views" => $views,
32
            "title" => "All questions"
33
        ]);
34
    }
35
}
36